Update CenterMentorSchema to include 'active' field for mentor status and adjust role assignment to use Role enum. Enhance payment cancellation logic in CronService to update associated order status to 'FAILED'. Bump epess-database subproject commit reference to reflect recent changes.
This commit is contained in:
Submodule epess-database updated: 6b4dece6b1...b0ab768c02
@@ -6,6 +6,7 @@ import { MailService } from '../Mail/mail.service'
|
|||||||
import { JwtUtils } from '../common/utils/jwt.utils'
|
import { JwtUtils } from '../common/utils/jwt.utils'
|
||||||
import { clerkClient } from '@clerk/express'
|
import { clerkClient } from '@clerk/express'
|
||||||
import { RedisService } from 'src/Redis/redis.service'
|
import { RedisService } from 'src/Redis/redis.service'
|
||||||
|
import { Role } from '@prisma/client'
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CenterMentorSchema extends PothosSchema {
|
export class CenterMentorSchema extends PothosSchema {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -38,6 +39,9 @@ export class CenterMentorSchema extends PothosSchema {
|
|||||||
center: t.relation('center', {
|
center: t.relation('center', {
|
||||||
description: 'The center.',
|
description: 'The center.',
|
||||||
}),
|
}),
|
||||||
|
active: t.exposeBoolean('active', {
|
||||||
|
description: 'Whether the mentor is active.',
|
||||||
|
}),
|
||||||
createdWorkshop: t.relation('createdWorkshop', {
|
createdWorkshop: t.relation('createdWorkshop', {
|
||||||
description: 'The workshops created by the center mentor.',
|
description: 'The workshops created by the center mentor.',
|
||||||
}),
|
}),
|
||||||
@@ -84,7 +88,7 @@ export class CenterMentorSchema extends PothosSchema {
|
|||||||
resolve: async (query, _root, args) => {
|
resolve: async (query, _root, args) => {
|
||||||
return await this.prisma.centerMentor.create({
|
return await this.prisma.centerMentor.create({
|
||||||
...query,
|
...query,
|
||||||
data: args.data,
|
data: { ...args.data, active: false },
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -259,7 +263,7 @@ export class CenterMentorSchema extends PothosSchema {
|
|||||||
await prisma.user.update({
|
await prisma.user.update({
|
||||||
where: args.where,
|
where: args.where,
|
||||||
data: {
|
data: {
|
||||||
role: 'CENTER_MENTOR',
|
role: Role.CENTER_MENTOR,
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -281,6 +285,7 @@ export class CenterMentorSchema extends PothosSchema {
|
|||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
adminNote: { connect: { id: adminNote.id } },
|
adminNote: { connect: { id: adminNote.id } },
|
||||||
|
active: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return updatedCenterMentor
|
return updatedCenterMentor
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ export class CronService {
|
|||||||
where: { id: payment.id },
|
where: { id: payment.id },
|
||||||
data: { status: PaymentStatus.CANCELLED },
|
data: { status: PaymentStatus.CANCELLED },
|
||||||
})
|
})
|
||||||
|
await this.prisma.order.update({
|
||||||
|
where: { id: payment.orderId },
|
||||||
|
data: { status: OrderStatus.FAILED },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user