feat(dto): update group and person DTOs with streamlined properties

- Added `description` field to create and update group DTOs.
- Simplified person DTOs by consolidating fields into `name`, replacing various attributes.
- Added `skills` field to create and update person DTOs for array-based skill representation.
This commit is contained in:
Mathis HERRIOT 2025-05-16 23:51:50 +02:00
parent 634c2d046e
commit 9620fd689d
No known key found for this signature in database
GPG Key ID: E7EB4A211D8D4907
4 changed files with 32 additions and 112 deletions

View File

@ -18,10 +18,17 @@ export class CreateGroupDto {
@IsUUID() @IsUUID()
projectId: string; projectId: string;
/**
* Optional description for the group
*/
@IsOptional()
@IsString()
description?: string;
/** /**
* Optional metadata for the group * Optional metadata for the group
*/ */
@IsOptional() @IsOptional()
@IsObject() @IsObject()
metadata?: Record<string, any>; metadata?: Record<string, any>;
} }

View File

@ -18,10 +18,17 @@ export class UpdateGroupDto {
@IsUUID() @IsUUID()
projectId?: string; projectId?: string;
/**
* Description for the group
*/
@IsOptional()
@IsString()
description?: string;
/** /**
* Metadata for the group * Metadata for the group
*/ */
@IsOptional() @IsOptional()
@IsObject() @IsObject()
metadata?: Record<string, any>; metadata?: Record<string, any>;
} }

View File

@ -4,31 +4,8 @@ import {
IsOptional, IsOptional,
IsObject, IsObject,
IsUUID, IsUUID,
IsEnum, IsArray
IsInt,
IsBoolean,
Min,
Max
} from 'class-validator'; } from 'class-validator';
import { Type } from 'class-transformer';
/**
* Enum for gender values
*/
export enum Gender {
MALE = 'MALE',
FEMALE = 'FEMALE',
NON_BINARY = 'NON_BINARY',
}
/**
* Enum for oral ease level values
*/
export enum OralEaseLevel {
SHY = 'SHY',
RESERVED = 'RESERVED',
COMFORTABLE = 'COMFORTABLE',
}
/** /**
* DTO for creating a new person * DTO for creating a new person
@ -36,48 +13,17 @@ export enum OralEaseLevel {
export class CreatePersonDto { export class CreatePersonDto {
@IsString() @IsString()
@IsNotEmpty() @IsNotEmpty()
firstName: string; name: string;
@IsString()
@IsNotEmpty()
lastName: string;
@IsEnum(Gender)
@IsNotEmpty()
gender: Gender;
@IsInt()
@Min(1)
@Max(5)
@Type(() => Number)
technicalLevel: number;
@IsBoolean()
@Type(() => Boolean)
hasTechnicalTraining: boolean;
@IsInt()
@Min(1)
@Max(5)
@Type(() => Number)
frenchSpeakingLevel: number;
@IsEnum(OralEaseLevel)
@IsNotEmpty()
oralEaseLevel: OralEaseLevel;
@IsInt()
@IsOptional()
@Min(18)
@Max(100)
@Type(() => Number)
age?: number;
@IsUUID() @IsUUID()
@IsNotEmpty() @IsNotEmpty()
projectId: string; projectId: string;
@IsArray()
@IsOptional()
skills?: string[];
@IsObject() @IsObject()
@IsOptional() @IsOptional()
attributes?: Record<string, any>; metadata?: Record<string, any>;
} }

View File

@ -3,14 +3,8 @@ import {
IsOptional, IsOptional,
IsObject, IsObject,
IsUUID, IsUUID,
IsEnum, IsArray
IsInt,
IsBoolean,
Min,
Max
} from 'class-validator'; } from 'class-validator';
import { Type } from 'class-transformer';
import { Gender, OralEaseLevel } from './create-person.dto';
/** /**
* DTO for updating a person * DTO for updating a person
@ -18,51 +12,17 @@ import { Gender, OralEaseLevel } from './create-person.dto';
export class UpdatePersonDto { export class UpdatePersonDto {
@IsString() @IsString()
@IsOptional() @IsOptional()
firstName?: string; name?: string;
@IsString()
@IsOptional()
lastName?: string;
@IsEnum(Gender)
@IsOptional()
gender?: Gender;
@IsInt()
@Min(1)
@Max(5)
@IsOptional()
@Type(() => Number)
technicalLevel?: number;
@IsBoolean()
@IsOptional()
@Type(() => Boolean)
hasTechnicalTraining?: boolean;
@IsInt()
@Min(1)
@Max(5)
@IsOptional()
@Type(() => Number)
frenchSpeakingLevel?: number;
@IsEnum(OralEaseLevel)
@IsOptional()
oralEaseLevel?: OralEaseLevel;
@IsInt()
@IsOptional()
@Min(18)
@Max(100)
@Type(() => Number)
age?: number;
@IsUUID() @IsUUID()
@IsOptional() @IsOptional()
projectId?: string; projectId?: string;
@IsArray()
@IsOptional()
skills?: string[];
@IsObject() @IsObject()
@IsOptional() @IsOptional()
attributes?: Record<string, any>; metadata?: Record<string, any>;
} }