update order and fix approve center

This commit is contained in:
2024-10-27 18:00:26 +07:00
parent 71971d7ae4
commit a5e9ad5ac1
4 changed files with 51 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ import {
import { Builder } from '../Graphql/graphql.builder';
import { PrismaService } from '../Prisma/prisma.service';
import { MinioService } from '../Minio/minio.service';
import { CenterStatus } from '@prisma/client';
import { CenterStatus, Role } from '@prisma/client';
import { MailService } from '../Mail/mail.service';
@Injectable()
export class CenterSchema extends PothosSchema {
@@ -231,6 +231,15 @@ export class CenterSchema extends PothosSchema {
if (!centerOwner) {
throw new Error('Center owner not found');
}
await prisma.user.update({
where: {
id: centerOwnerId,
},
data: {
role: Role.CENTER_OWNER,
},
});
// update center status
const updatedCenter = await prisma.center.update({
...query,
where: {