Minimal refactoring

This commit is contained in:
Douglas Barone 2020-12-01 15:19:03 -04:00
parent 04a2fb01cb
commit 52d561f396

View File

@ -90,7 +90,7 @@ const Query = {
} }
}, },
wifiDevices: async (_, { identifiedOnly, nonIdentifiedOnly }) => { async wifiDevices(_, { identifiedOnly, nonIdentifiedOnly }) {
if (identifiedOnly && nonIdentifiedOnly) if (identifiedOnly && nonIdentifiedOnly)
throw new Error('Invalid combination of filters') throw new Error('Invalid combination of filters')
@ -107,14 +107,14 @@ const Query = {
}) })
}, },
wifiUsers: () => { async wifiUsers() {
return prisma.user.findMany({ return prisma.user.findMany({
where: { wifiDevices: { some: { NOT: { lastSeen: null } } } }, where: { wifiDevices: { some: { id: { not: undefined } } } },
include: { wifiDevices: true } include: { wifiDevices: true }
}) })
}, },
userPresence: async (_, { search }) => { async userPresence(_, { search }) {
if (!search) search = '' if (!search) search = ''
updateDBWithOnlineDevices() updateDBWithOnlineDevices()