diff --git a/src/Cron/cron.service.ts b/src/Cron/cron.service.ts index 8b53100..46a6e80 100644 --- a/src/Cron/cron.service.ts +++ b/src/Cron/cron.service.ts @@ -94,10 +94,10 @@ export class CronService { @Cron(CronExpression.EVERY_MINUTE) async handleRefundTicket() { Logger.log('Handling refund ticket', 'handleRefundTicket') - // get all orders where status is PENDING_REFUND or REFUNDED and has schedule.dates in future + // get all orders where status is REFUNDED and has schedule.dates in future const orders = await this.prisma.order.findMany({ where: { - status: { in: [OrderStatus.PENDING_REFUND, OrderStatus.REFUNDED] }, + status: OrderStatus.REFUNDED, schedule: { dates: { some: { diff --git a/src/RefundTicket/refundticket.schema.ts b/src/RefundTicket/refundticket.schema.ts index 8cfdf42..2de1c05 100644 --- a/src/RefundTicket/refundticket.schema.ts +++ b/src/RefundTicket/refundticket.schema.ts @@ -116,6 +116,7 @@ export class RefundTicketSchema extends PothosSchema { let refundAmount = 0 if (diffDays < 24) refundAmount = order.total else if (diffDays < 48) refundAmount = order.total * 0.5 + if (refundAmount === 0) throw new Error('Cannot refund after 72 hours') // create refund ticket const refundTicket = await this.prisma.refundTicket.create({ data: { diff --git a/src/Workshop/workshop.schema.ts b/src/Workshop/workshop.schema.ts index c14ca49..1babf33 100644 --- a/src/Workshop/workshop.schema.ts +++ b/src/Workshop/workshop.schema.ts @@ -35,6 +35,18 @@ export class WorkshopSchema extends PothosSchema { serviceId: t.exposeID('serviceId', { description: 'The ID of the service that the workshop is for.', }), + expectedParticipants: t.exposeInt('expectedParticipants', { + description: 'The expected number of participants for the workshop.', + }), + minParticipants: t.exposeInt('minParticipants', { + description: 'The minimum number of participants for the workshop.', + }), + registeredParticipants: t.exposeInt('registeredParticipants', { + description: 'The number of participants registered for the workshop.', + }), + actualParticipants: t.exposeInt('actualParticipants', { + description: 'The number of participants actually attending the workshop.', + }), imageFile: t.relation('imageFile', { nullable: true, }),