add centerstaff mutation

This commit is contained in:
2024-10-13 19:38:51 +07:00
parent 1f86786e1a
commit 75a10356da
7 changed files with 99 additions and 25 deletions

View File

@@ -63,20 +63,23 @@ export class UserSchema extends PothosSchema {
});
},
}),
// userByToken: t.prismaField({
// type: this.user(),
// args: this.builder.args({
// oauthToken: t.arg.string({ required: true }),
// }),
// resolve: async (query, root, args, ctx, info) => {
// // check if the token is valid
// const { user } = await clerkClient.verifyToken
// return await this.prisma.user.findFirst({
// ...query,
// where: args.where,
// });
// },
// }),
userBySession: t.prismaField({
type: this.user(),
args: {
sessionId: t.arg({ type: 'String', required: true }),
},
resolve: async (query, root, args, ctx, info) => {
// check if the token is valid
const session = await clerkClient.sessions.getSession(args.sessionId);
console.log(session);
return await this.prisma.user.findFirst({
...query,
where: {
id: session.userId,
},
});
},
}),
}));
// Mutation section