fix(employee) change dto so that module access is typesafe, modify update route to exclude session email

This commit is contained in:
Nicolas Drolet 2025-12-03 16:59:03 -05:00
parent 35a71d217a
commit 838189ae1f
3 changed files with 13 additions and 3 deletions

View File

@ -542,6 +542,16 @@
"patch": { "patch": {
"operationId": "EmployeesController_updateEmployee", "operationId": "EmployeesController_updateEmployee",
"parameters": [], "parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmployeeDetailedDto"
}
}
}
},
"responses": { "responses": {
"200": { "200": {
"description": "" "description": ""

View File

@ -44,7 +44,7 @@ export class EmployeesController {
@Patch('update') @Patch('update')
@ModuleAccessAllowed(ModulesEnum.employee_management) @ModuleAccessAllowed(ModulesEnum.employee_management)
async updateEmployee(@Access('email') email:string, dto:EmployeeDetailedDto, employee_email?: string){ async updateEmployee(@Body() dto:EmployeeDetailedDto){
return await this.updateService.updateEmployee(email, dto, employee_email); return await this.updateService.updateEmployee(dto);
} }
} }

View File

@ -15,5 +15,5 @@ export class EmployeeDetailedDto {
@IsDateString() @IsOptional() last_work_day?: string; @IsDateString() @IsOptional() last_work_day?: string;
@IsString() @IsOptional() residence?: string; @IsString() @IsOptional() residence?: string;
@IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number; @IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number;
@IsString() @IsArray() user_module_access: string[]; @IsArray() @IsString({ each: true }) user_module_access: string[];
} }