push code ne

This commit is contained in:
2024-10-28 01:08:13 +07:00
parent 571bb93e28
commit eec9fcfeff
20 changed files with 296 additions and 118 deletions

View File

@@ -44,6 +44,9 @@ export class ServiceSchema extends PothosSchema {
userId: t.exposeID('userId', {
description: 'The ID of the user who requested the service.',
}),
adminNote: t.relation('adminNote', {
description: 'The admin note of the service.',
}),
price: t.exposeFloat('price', {
description: 'The price of the service.',
}),
@@ -257,7 +260,7 @@ export class ServiceSchema extends PothosSchema {
: ServiceStatus.REJECTED,
},
});
// mail to center owner and staff who requested the service
// mail to center owner and mentor who requested the service
const center = await prisma.center.findUnique({
where: { id: service.centerId },
});
@@ -270,11 +273,11 @@ export class ServiceSchema extends PothosSchema {
if (!centerOwner) {
throw new Error('Center owner not found');
}
const centerStaff = await prisma.centerStaff.findMany({
const centerMentor = await prisma.centerMentor.findMany({
where: { centerId: service.centerId },
});
const staffEmails = centerStaff.map((staff) => staff.staffId);
const emails = [centerOwner.email, ...staffEmails];
const mentorEmails = centerMentor.map((mentor) => mentor.mentorId);
const emails = [centerOwner.email, ...mentorEmails];
for (const email of emails) {
await this.mailService.sendEmail(
email,