Improve sorting

This commit is contained in:
Douglas Barone 2020-12-21 10:24:25 -04:00
parent 5d462431d4
commit bb894c04e0

View File

@ -5,7 +5,7 @@ export async function wifiDevices(_, { identifiedOnly, nonIdentifiedOnly }) {
throw new Error('Invalid combination of filters') throw new Error('Invalid combination of filters')
return prisma.wifiDevice.findMany({ return prisma.wifiDevice.findMany({
orderBy: [{ lastSeen: 'desc' }], orderBy: [{ lastSeen: 'desc' }, { hostname: 'asc' }],
where: identifiedOnly where: identifiedOnly
? { NOT: { userId: null } } ? { NOT: { userId: null } }
: nonIdentifiedOnly : nonIdentifiedOnly