diff --git a/src/booking/dtos/create-booking.dto.ts b/src/booking/dtos/create-booking.dto.ts index 4f453b2..d28eda6 100644 --- a/src/booking/dtos/create-booking.dto.ts +++ b/src/booking/dtos/create-booking.dto.ts @@ -1,5 +1,12 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsDate, IsNotEmpty, IsString, IsUUID, Matches } from 'class-validator'; +import { + IsDate, + IsNotEmpty, + IsString, + IsUUID, + Matches, + MinDate, +} from 'class-validator'; export class CreateBookingDto { @ApiProperty({ @@ -15,6 +22,7 @@ export class CreateBookingDto { }) @IsNotEmpty() @IsDate() + @MinDate(new Date()) date: Date; @ApiProperty({ example: '09:00' }) diff --git a/src/booking/services/bookable-space.service.ts b/src/booking/services/bookable-space.service.ts index c497f83..6a2c07e 100644 --- a/src/booking/services/bookable-space.service.ts +++ b/src/booking/services/bookable-space.service.ts @@ -54,7 +54,8 @@ export class BookableSpaceService { .createQueryBuilder('space') .leftJoinAndSelect('space.parent', 'parentSpace') .leftJoinAndSelect('space.community', 'community') - .where('community.project = :project', { project }); + .where('space.disabled = :disabled', { disabled: false }) + .andWhere('community.project = :project', { project }); if (search) { qb = qb.andWhere(