2025-05-14 21:45:16 +02:00

44 lines
1.2 KiB
TypeScript

import { Field, InputType, Int, ArgsType, ObjectType } from 'type-graphql';
import { GetManyArgsWithDateRange } from '@seed/graphql/Request';
import { BookingEngineBaseSchema } from './bookings.engine.schema';
import { IsRefExist } from '@seed/engine/decorators/db.guard';
import { BookingsRessourceEnum } from '@src/__components/components';
import { IsNotEmpty, ValidateIf, ValidateNested } from 'class-validator';
import { StatusEnum } from '@seed/interfaces/components';
@ObjectType()
@InputType()
export class BookingEngineNewInputSchema extends BookingEngineBaseSchema {
@Field(() => BookingsRessourceEnum)
@IsNotEmpty()
ressourceModel: BookingsRessourceEnum;
@Field()
@IsNotEmpty()
@IsRefExist()
ressourceId: string;
}
@InputType()
export class BookingEngineEditInputSchema {
@Field(() => Int, { nullable: true })
capacity: number;
@Field({ nullable: true })
comments?: string;
}
@ArgsType()
export class BookingEngineArgsSchema extends GetManyArgsWithDateRange {
@Field(() => BookingsRessourceEnum, { nullable: true })
ressourceModel?: BookingsRessourceEnum;
@Field({ nullable: true })
ressourceId?: string;
@Field(() => [StatusEnum], { nullable: true })
status?: StatusEnum[];
}