This commit is contained in:
Douglas Barone 2022-04-11 15:43:10 -04:00
parent 619f9661a0
commit ce91516b23
2 changed files with 16 additions and 4 deletions

View File

@ -35,9 +35,7 @@ export async function wifiUsers(parent, { take = 100, skip = 0, search }) {
] ]
}, },
include: { include: {
wifiDevices: { wifiDevices: true
include: { accessPoint: true }
}
}, },
orderBy: [ orderBy: [
{ wifiDevices: { _count: 'desc' } }, { wifiDevices: { _count: 'desc' } },

View File

@ -17,7 +17,21 @@ const WifiDevice = {
accessPoint: async parent => { accessPoint: async parent => {
return prisma.accessPoint.findUnique({ where: { id: parent.accessPointId } }) try {
const ap = await prisma.accessPoint.findUnique({ where: { hostname: parent.apName } })
if (ap)
return ap
else
return null
}
catch (e) {
logError({
tags: ['wifiDevice', 'accessPoint'],
message: `Could not find access point ${parent.apName}`,
data: parent
})
}
} }
} }