diff --git a/server/src/resolvers/Query/accessPoint.js b/server/src/resolvers/Query/accessPoint.js new file mode 100644 index 0000000..fd4f3a1 --- /dev/null +++ b/server/src/resolvers/Query/accessPoint.js @@ -0,0 +1,8 @@ +import prisma from '../../prisma' + +export async function accessPoint(parent, { id }, context, info) { + return prisma.accessPoint.findUnique({ + where: { id: parseInt(id) }, + include: { wifiDevices: true } + }) +} diff --git a/server/src/resolvers/Query/index.js b/server/src/resolvers/Query/index.js index 24b7257..2bb9ff4 100644 --- a/server/src/resolvers/Query/index.js +++ b/server/src/resolvers/Query/index.js @@ -1,4 +1,5 @@ import { accessPoints } from './accessPoints' +import { accessPoint } from './accessPoint' import { basicUser } from './basicUser' import { groups } from './groups' import { logs } from './logs' @@ -13,6 +14,7 @@ import { wifiUsers } from './wifiUsers' const Query = { accessPoints, + accessPoint, basicUser, groups, logs, diff --git a/server/src/typeDefs.js b/server/src/typeDefs.js index ca6f005..8a21c09 100644 --- a/server/src/typeDefs.js +++ b/server/src/typeDefs.js @@ -56,6 +56,9 @@ const typeDefs = gql` "All Access Points" accessPoints: [AccessPoint!]! @auth(roles: ["superAdmin"]) + + "One Access Point" + accessPoint(id: ID!): AccessPoint! @auth(roles: ["superAdmin"]) } type Mutation { @@ -94,7 +97,7 @@ const typeDefs = gql` "Remove a PA host" delPAHost(id: Int!): PAHost! @auth(roles: ["superAdmin"]) - "Update Access Points" + "Force Update Access Points" updateAccessPoints: String! @auth(roles: ["superAdmin"]) }