From f8a70deed2ac66850e556ab032498427eb684169 Mon Sep 17 00:00:00 2001 From: Matthieu Haineault Date: Wed, 3 Dec 2025 15:43:03 -0500 Subject: [PATCH] fix(employees): fix update employees --- .../services/employees-update.service.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/identity-and-account/employees/services/employees-update.service.ts b/src/identity-and-account/employees/services/employees-update.service.ts index 032c81f..2bb57be 100644 --- a/src/identity-and-account/employees/services/employees-update.service.ts +++ b/src/identity-and-account/employees/services/employees-update.service.ts @@ -31,16 +31,26 @@ export class EmployeesUpdateService { email: dto.email, phone_number: dto.phone_number, residence: dto.residence, - user_module_access: { - update: { - dashboard: normalized_access.dashboard, - employee_list: normalized_access.employee_list, - employee_management: normalized_access.employee_management, - personal_profile: normalized_access.personal_profile, - timesheets: normalized_access.timesheets, - timesheets_approval: normalized_access.timesheets_approval, - }, - }, + }, + }); + await tx.userModuleAccess.upsert({ + where: { user_id: user_id.data }, + update: { + dashboard: normalized_access.dashboard, + employee_list: normalized_access.employee_list, + employee_management: normalized_access.employee_management, + personal_profile: normalized_access.personal_profile, + timesheets: normalized_access.timesheets, + timesheets_approval: normalized_access.timesheets_approval, + }, + create: { + user_id: user_id.data, + dashboard: normalized_access.dashboard, + employee_list: normalized_access.employee_list, + employee_management: normalized_access.employee_management, + personal_profile: normalized_access.personal_profile, + timesheets: normalized_access.timesheets, + timesheets_approval: normalized_access.timesheets_approval, }, }); return tx.employees.update({