Skip to content

Commit

Permalink
Readd all users query
Browse files Browse the repository at this point in the history
  • Loading branch information
BoogieMonster1O1 committed Jun 21, 2024
1 parent e0cc91a commit 36da3e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/App/GraphQL/Query/Resolver+GetRegisteredUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import Fluent
import Vapor

extension Resolver {
// func getAllRegisteredUsers(request: Request, arguments: NoArguments) async throws -> [RegisteredUser] {
// try await assertScope(request: request, [.query, .read])
// return try await RegisteredUser.query(on: request.db).all()
// }
func getAllRegisteredUsers(request: Request, arguments: NoArguments) async throws -> [RegisteredUser] {
try await verifyAccessToken(req: request)
return try await RegisteredUser.query(on: request.db).all()
}

func getRegisteredUser(request: Request, arguments: IntIdArgs) async throws -> RegisteredUser {
let user = try await getContextUser(request)
Expand Down
1 change: 1 addition & 0 deletions Sources/App/GraphQL/Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ let schema = try! Graphiti.Schema<Resolver, Request> {
}

Query {
Field("users", at: Resolver.getAllRegisteredUsers)
Field("self", at: Resolver.getSelf)
Field("user", at: Resolver.getRegisteredUser) {
Argument("id", at: \.id)
Expand Down

0 comments on commit 36da3e7

Please sign in to comment.