fix(access): fix module access create

This commit is contained in:
Matthieu Haineault 2025-12-15 09:26:59 -05:00
parent 4b0a45adcc
commit b9c838d3e5

View File

@ -1,11 +1,10 @@
import { Injectable } from "@nestjs/common";
import { Users } from "@prisma/client";
import { Result } from "src/common/errors/result-error.factory";
import { Modules } from "src/common/mappers/module-access.mapper";
import { toBooleanFromKeys } from "src/common/utils/boolean-utils";
import { toDateFromString } from "src/common/utils/date-utils";
import { EmployeeDetailedDto } from "src/identity-and-account/employees/employee-detailed.dto";
import { toCompanyCodeFromString } from "src/identity-and-account/employees/employee.utils";
import { toBooleanFromString } from "src/identity-and-account/employees/services/employees-get.service";
import { PrismaService } from "src/prisma/prisma.service";
@Injectable()
@ -13,7 +12,7 @@ export class EmployeesCreateService {
constructor(private readonly prisma: PrismaService) { }
async createEmployee(dto: EmployeeDetailedDto): Promise<Result<boolean, string>> {
const normalized_access = toBooleanFromKeys<Modules>(dto.user_module_access);
const normalized_access = toBooleanFromString(dto.user_module_access);
const supervisor_id = await this.toIdFromFullName(dto.supervisor_full_name);
const company_code = toCompanyCodeFromString(dto.company_name);
const first_work_day = toDateFromString(dto.first_work_day);