forked from Ynov/ptitspas-ynov-back
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import { ApiProperty } from "@nestjs/swagger";
|
|
import { IsBoolean, IsDateString, IsEnum, IsNotEmpty, IsOptional, IsString, IsUUID, MaxLength, ValidateIf } from "class-validator";
|
|
import { GenreType, StatutEnfantType } from "src/entities/children.entity";
|
|
|
|
export class CreateEnfantsDto {
|
|
@ApiProperty({ enum: StatutEnfantType, example: StatutEnfantType.ACTIF })
|
|
@IsEnum(StatutEnfantType)
|
|
@IsNotEmpty()
|
|
status: StatutEnfantType;
|
|
|
|
@ApiProperty({ example: 'Georges', required: false })
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(100)
|
|
first_name?: string;
|
|
|
|
@ApiProperty({ example: 'Lucas', required: false })
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(100)
|
|
last_name?: string;
|
|
|
|
@ApiProperty({ enum: GenreType, required: false })
|
|
@IsOptional()
|
|
@IsEnum(GenreType)
|
|
gender?: GenreType;
|
|
|
|
@ApiProperty({ example: '2018-06-24', required: false })
|
|
@ValidateIf(o => o.status !== StatutEnfantType.A_NAITRE)
|
|
@IsOptional()
|
|
@IsDateString()
|
|
birth_date?: string;
|
|
|
|
@ApiProperty({ example: '2024-12-24', required: false })
|
|
@ValidateIf(o => o.status === StatutEnfantType.A_NAITRE)
|
|
@IsOptional()
|
|
@IsDateString()
|
|
due_date?: string;
|
|
|
|
@ApiProperty({ example: 'https://monimage.com/photo.jpg', required: false })
|
|
@IsOptional()
|
|
@IsString()
|
|
photo_url?: string;
|
|
|
|
@ApiProperty({ default: false })
|
|
@IsBoolean()
|
|
consent_photo: boolean;
|
|
|
|
@ApiProperty({ required: false })
|
|
@IsOptional()
|
|
@IsDateString()
|
|
consent_photo_at?: string;
|
|
|
|
@ApiProperty({ default: false })
|
|
@IsBoolean()
|
|
is_multiple: boolean;
|
|
|
|
@ApiProperty({ example: 'UUID-parent' })
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
id_parent: string;
|
|
|
|
}
|