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 { IsBoolean, IsDateString, IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Length, Matches, Max, Min } from "class-validator";
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()
@IsOptional()
@IsNotEmpty()
user_id?: string;
@IsString()
@IsOptional()
@IsNotEmpty()
@Length(1, 50)
approval_number?: string;
approval_number: string;
@Matches(/^\d{15}$/)
@IsOptional()
nir?: string;
@IsNotEmpty()
nir: string;
@IsInt()
@Min(1)
@Max(10)
@IsOptional()
max_children?: number;
@IsNotEmpty()
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()
@IsString()
biography?: string;
@IsOptional()
@IsBoolean()
available?: boolean;
@IsOptional()
@IsString()
@Length(1, 100)
residence_city?: string;
@IsOptional()
@IsDateString()
agreement_date?: string;
@IsOptional()
@IsInt()
@Min(0)
years_experience?: number;
@IsOptional()
@IsString()
@Length(1, 100)
specialty?: string;
@IsOptional()
@IsInt()
@Min(0)
places_available?: number;
}

View File

@ -1,8 +1,8 @@
import { OmitType } from "@nestjs/swagger";
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()
@IsNotEmpty()
user_id: string;
@ -10,4 +10,8 @@ export class CreateParentDto extends OmitType(CreateUserDto, ['role'] as const)
@IsOptional()
@IsUUID()
co_parent_id?: string;
@IsString()
@IsNotEmpty()
photo_url: string;
}