diff --git a/src/modules/class/class.service.ts b/src/modules/class/class.service.ts index 33fb586..c1515cd 100644 --- a/src/modules/class/class.service.ts +++ b/src/modules/class/class.service.ts @@ -110,6 +110,10 @@ export class ClassService { const date = moment(createRoomClassDto.date); + // Check if the date is before the current date + if (date.isBefore(moment().startOf("day"))) + throw new HttpException("Can't create a room for a class that has passed", 400); + const firstTimeStart = createRoomClassDto.times.reduce((prev, current) => moment(current.start, "HH:mm").isBefore(moment(prev.start, "HH:mm")) ? current