update transaction
This commit is contained in:
@@ -384,15 +384,16 @@ export class UserSchema extends PothosSchema {
|
||||
email: t.arg({ type: 'String', required: true }),
|
||||
},
|
||||
resolve: async (_parent, args, ctx) => {
|
||||
// check context
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Not allowed')
|
||||
}
|
||||
// check context is admin
|
||||
|
||||
if (ctx.http.me?.role !== 'ADMIN') {
|
||||
throw new UnauthorizedException(`Only admin can invite moderator`)
|
||||
}
|
||||
return this.prisma.$transaction(async (tx) => {
|
||||
// check context
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Not allowed')
|
||||
}
|
||||
// check context is admin
|
||||
if (ctx.http.me?.role !== 'ADMIN') {
|
||||
throw new UnauthorizedException(`Only admin can invite moderator`)
|
||||
}
|
||||
let user
|
||||
// perform update role
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user