dto finally corrected

This commit is contained in:
sdraris 2025-09-23 11:54:18 +02:00
parent 740b88eceb
commit 450627b091
2 changed files with 32 additions and 39 deletions

View File

@ -1,67 +1,56 @@
import { OmitType } from "@nestjs/swagger"; import { OmitType } from "@nestjs/swagger";
import { IsBoolean, IsDateString, IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Length, Matches, Max, Min } from "class-validator";
import { CreateUserDto } from "./create_user.dto"; import { CreateUserDto } from "./create_user.dto";
import {
IsBoolean,
IsDateString,
IsInt,
IsOptional,
IsString,
IsUUID,
Length,
Matches,
Max,
Min
} from "class-validator";
export class CreateAssistanteDto extends OmitType(CreateUserDto, ['role'] as const) { export class CreateAssistanteDto extends OmitType(CreateUserDto, ['role', 'photo_url', 'consentement_photo'] as const) {
@IsUUID() @IsUUID()
@IsOptional() @IsNotEmpty()
user_id?: string; user_id?: string;
@IsString() @IsString()
@IsOptional() @IsNotEmpty()
@Length(1, 50) @Length(1, 50)
approval_number?: string; approval_number: string;
@Matches(/^\d{15}$/) @Matches(/^\d{15}$/)
@IsOptional() @IsNotEmpty()
nir?: string; nir: string;
@IsInt() @IsInt()
@Min(1) @Min(1)
@Max(10) @Max(10)
@IsOptional() @IsNotEmpty()
max_children?: number; max_children: number;
@IsString()
@IsNotEmpty()
photo_url: string;
@IsBoolean()
@IsNotEmpty()
consentement_photo: boolean;
@IsDateString()
@IsNotEmpty()
agreement_date: string;
@IsString()
@IsNotEmpty()
@Length(1, 100)
residence_city: string;
@IsOptional() @IsOptional()
@IsString()
biography?: string; biography?: string;
@IsOptional() @IsOptional()
@IsBoolean()
available?: boolean; available?: boolean;
@IsOptional() @IsOptional()
@IsString()
@Length(1, 100)
residence_city?: string;
@IsOptional()
@IsDateString()
agreement_date?: string;
@IsOptional()
@IsInt()
@Min(0)
years_experience?: number; years_experience?: number;
@IsOptional() @IsOptional()
@IsString()
@Length(1, 100)
specialty?: string; specialty?: string;
@IsOptional() @IsOptional()
@IsInt()
@Min(0)
places_available?: number; places_available?: number;
} }

View File

@ -1,8 +1,8 @@
import { OmitType } from "@nestjs/swagger"; import { OmitType } from "@nestjs/swagger";
import { CreateUserDto } from "./create_user.dto"; import { CreateUserDto } from "./create_user.dto";
import { IsNotEmpty, IsOptional, IsUUID } from "class-validator"; import { IsNotEmpty, IsOptional, IsString, IsUUID } from "class-validator";
export class CreateParentDto extends OmitType(CreateUserDto, ['role'] as const) { export class CreateParentDto extends OmitType(CreateUserDto, ['role', 'photo_url'] as const) {
@IsUUID() @IsUUID()
@IsNotEmpty() @IsNotEmpty()
user_id: string; user_id: string;
@ -10,4 +10,8 @@ export class CreateParentDto extends OmitType(CreateUserDto, ['role'] as const)
@IsOptional() @IsOptional()
@IsUUID() @IsUUID()
co_parent_id?: string; co_parent_id?: string;
@IsString()
@IsNotEmpty()
photo_url: string;
} }