Fixed wifiDevices query

This commit is contained in:
Douglas Barone 2020-11-10 16:59:48 -04:00
parent 1a69ad12e0
commit f470be38cb
2 changed files with 3 additions and 3 deletions

View File

@ -98,9 +98,10 @@ const Query = {
// console.log('PubSub') //TODO: PubSub // console.log('PubSub') //TODO: PubSub
// }) // })
return prisma.wifiDevices({ return prisma.wifiDevice.findMany({
orderBy: [{ lastSeen: 'desc' }], orderBy: [{ lastSeen: 'desc' }],
where: identifiedOnly ? { NOT: { user: null } } : {} where: identifiedOnly ? { NOT: { userId: null } } : {},
include: { user: true }
}) })
}, },

View File

@ -1,7 +1,6 @@
import prisma from '../prisma' import prisma from '../prisma'
const WifiDevice = { const WifiDevice = {
user: _ => prisma.wifiDevice.findOne({ where: { id: _.id } }).User(),
lastSeen: _ => _.lastSeen.toISOString(), lastSeen: _ => _.lastSeen.toISOString(),
firstSeen: _ => _.firstSeen.toISOString() firstSeen: _ => _.firstSeen.toISOString()
} }