fix(access): fix module access create
This commit is contained in:
parent
4b0a45adcc
commit
b9c838d3e5
|
|
@ -1,11 +1,10 @@
|
||||||
import { Injectable } from "@nestjs/common";
|
import { Injectable } from "@nestjs/common";
|
||||||
import { Users } from "@prisma/client";
|
import { Users } from "@prisma/client";
|
||||||
import { Result } from "src/common/errors/result-error.factory";
|
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 { toDateFromString } from "src/common/utils/date-utils";
|
||||||
import { EmployeeDetailedDto } from "src/identity-and-account/employees/employee-detailed.dto";
|
import { EmployeeDetailedDto } from "src/identity-and-account/employees/employee-detailed.dto";
|
||||||
import { toCompanyCodeFromString } from "src/identity-and-account/employees/employee.utils";
|
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";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
@ -13,7 +12,7 @@ export class EmployeesCreateService {
|
||||||
constructor(private readonly prisma: PrismaService) { }
|
constructor(private readonly prisma: PrismaService) { }
|
||||||
|
|
||||||
async createEmployee(dto: EmployeeDetailedDto): Promise<Result<boolean, string>> {
|
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 supervisor_id = await this.toIdFromFullName(dto.supervisor_full_name);
|
||||||
const company_code = toCompanyCodeFromString(dto.company_name);
|
const company_code = toCompanyCodeFromString(dto.company_name);
|
||||||
const first_work_day = toDateFromString(dto.first_work_day);
|
const first_work_day = toDateFromString(dto.first_work_day);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user