day len server theo loi Khoi noi, toi xin tuyen bo mien tru trach nhiem

This commit is contained in:
2024-11-05 15:02:53 +07:00
parent 0f68b51d75
commit 56ba2808c8
22 changed files with 482 additions and 63 deletions

View File

@@ -262,7 +262,10 @@ export class UserSchema extends PothosSchema {
if (ctx.isSubscription) {
throw new Error('Not allowed')
}
const id = ctx.http.me.id
const id = ctx.http.me?.id
if (!id) {
throw new Error('User not found')
}
if (args.imageBlob) {
const { mimetype, createReadStream } = await args.imageBlob
if (mimetype && createReadStream) {
@@ -333,7 +336,7 @@ export class UserSchema extends PothosSchema {
throw new Error('Not allowed')
}
// check context is admin
if (ctx.http.me.role !== 'ADMIN') {
if (ctx.http.me?.role !== 'ADMIN') {
throw new UnauthorizedException(`Only admin can invite moderator`)
}
let user