add context subscription

This commit is contained in:
2024-10-29 02:21:18 +07:00
parent ba54d3466c
commit 9423a36eeb
7 changed files with 58 additions and 19 deletions

View File

@@ -127,10 +127,13 @@ export class UserSchema extends PothosSchema {
},
}),
me: t.prismaField({
description: 'Retrieve the current user by token.',
description: 'Retrieve the current user in context.',
type: this.user(),
resolve: async (query, root, args, ctx) => {
return ctx.me;
if (ctx.isSubscription) {
throw new Error('Not allowed');
}
return ctx.http.me;
},
}),