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()
projectId: string;
/**
* Optional description for the group
*/
@IsOptional()
@IsString()
description?: string;
/**
* Optional metadata for the group
*/
@IsOptional()
@IsObject()
metadata?: Record<string, any>;
}
}

View File

@ -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<string, any>;
}
}

View File

@ -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<string, any>;
}
metadata?: Record<string, any>;
}

View File

@ -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<string, any>;
}
metadata?: Record<string, any>;
}