Fix client count
This commit is contained in:
parent
0b7b8b4c69
commit
bf93c9fc43
|
@ -1,3 +1,13 @@
|
||||||
|
import prisma from "../prisma";
|
||||||
|
|
||||||
export const AccessPoint = {
|
export const AccessPoint = {
|
||||||
updatedAt: parent => parent.updatedAt?.toISOString()
|
updatedAt: parent => parent.updatedAt?.toISOString(),
|
||||||
|
clients: parent => prisma.wifiDevice.count({
|
||||||
|
where: {
|
||||||
|
status: 'ONLINE',
|
||||||
|
accessPoint: {
|
||||||
|
id: parent.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import prisma from '../../prisma'
|
import prisma from '../../prisma'
|
||||||
|
|
||||||
export async function accessPoint(parent, { id }, context, info) {
|
export async function accessPoint(parent, { id }, context, info) {
|
||||||
return prisma.accessPoint.findUnique({
|
const ap = prisma.accessPoint.findUnique({
|
||||||
where: { id: parseInt(id) },
|
where: { id: parseInt(id) },
|
||||||
include: {
|
include: {
|
||||||
wifiDevices: {
|
wifiDevices: {
|
||||||
|
@ -11,4 +11,6 @@ export async function accessPoint(parent, { id }, context, info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log(ap);
|
||||||
|
return ap
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,11 @@ export async function accessPoints() {
|
||||||
hostname: 'asc'
|
hostname: 'asc'
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
wifiDevices: true
|
wifiDevices: {
|
||||||
|
where: {
|
||||||
|
status: 'ONLINE'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user