Minimal refactoring

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

View File

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