From 9620fd689dac09fc5e3427db6dbdc00607e43484 Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Fri, 16 May 2025 23:51:50 +0200 Subject: [PATCH] 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. --- .../modules/groups/dto/create-group.dto.ts | 9 ++- .../modules/groups/dto/update-group.dto.ts | 9 ++- .../modules/persons/dto/create-person.dto.ts | 70 +++---------------- .../modules/persons/dto/update-person.dto.ts | 56 +++------------ 4 files changed, 32 insertions(+), 112 deletions(-) diff --git a/backend/src/modules/groups/dto/create-group.dto.ts b/backend/src/modules/groups/dto/create-group.dto.ts index bf7f2f2..e87b8da 100644 --- a/backend/src/modules/groups/dto/create-group.dto.ts +++ b/backend/src/modules/groups/dto/create-group.dto.ts @@ -18,10 +18,17 @@ export class CreateGroupDto { @IsUUID() projectId: string; + /** + * Optional description for the group + */ + @IsOptional() + @IsString() + description?: string; + /** * Optional metadata for the group */ @IsOptional() @IsObject() metadata?: Record; -} \ No newline at end of file +} diff --git a/backend/src/modules/groups/dto/update-group.dto.ts b/backend/src/modules/groups/dto/update-group.dto.ts index 3ef4deb..256bac1 100644 --- a/backend/src/modules/groups/dto/update-group.dto.ts +++ b/backend/src/modules/groups/dto/update-group.dto.ts @@ -18,10 +18,17 @@ export class UpdateGroupDto { @IsUUID() projectId?: string; + /** + * Description for the group + */ + @IsOptional() + @IsString() + description?: string; + /** * Metadata for the group */ @IsOptional() @IsObject() metadata?: Record; -} \ No newline at end of file +} diff --git a/backend/src/modules/persons/dto/create-person.dto.ts b/backend/src/modules/persons/dto/create-person.dto.ts index 0ee4257..28ea087 100644 --- a/backend/src/modules/persons/dto/create-person.dto.ts +++ b/backend/src/modules/persons/dto/create-person.dto.ts @@ -4,31 +4,8 @@ import { IsOptional, IsObject, IsUUID, - IsEnum, - IsInt, - IsBoolean, - Min, - Max + IsArray } 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 @@ -36,48 +13,17 @@ export enum OralEaseLevel { export class CreatePersonDto { @IsString() @IsNotEmpty() - firstName: 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; + name: string; @IsUUID() @IsNotEmpty() projectId: string; + @IsArray() + @IsOptional() + skills?: string[]; + @IsObject() @IsOptional() - attributes?: Record; -} \ No newline at end of file + metadata?: Record; +} diff --git a/backend/src/modules/persons/dto/update-person.dto.ts b/backend/src/modules/persons/dto/update-person.dto.ts index b2925ca..60fc435 100644 --- a/backend/src/modules/persons/dto/update-person.dto.ts +++ b/backend/src/modules/persons/dto/update-person.dto.ts @@ -3,14 +3,8 @@ import { IsOptional, IsObject, IsUUID, - IsEnum, - IsInt, - IsBoolean, - Min, - Max + IsArray } from 'class-validator'; -import { Type } from 'class-transformer'; -import { Gender, OralEaseLevel } from './create-person.dto'; /** * DTO for updating a person @@ -18,51 +12,17 @@ import { Gender, OralEaseLevel } from './create-person.dto'; export class UpdatePersonDto { @IsString() @IsOptional() - firstName?: 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; + name?: string; @IsUUID() @IsOptional() projectId?: string; + @IsArray() + @IsOptional() + skills?: string[]; + @IsObject() @IsOptional() - attributes?: Record; -} \ No newline at end of file + metadata?: Record; +}