fix(create-employee): date was passed directly as string, fixed to pass date object.
This commit is contained in:
parent
acc128e5ea
commit
3b01aa3748
|
|
@ -2,6 +2,7 @@ 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 { toBooleanFromString } from "src/common/mappers/module-access.mapper";
|
import { toBooleanFromString } from "src/common/mappers/module-access.mapper";
|
||||||
|
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 { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
|
|
@ -13,7 +14,8 @@ export class EmployeesCreateService {
|
||||||
async createEmployee(dto: EmployeeDetailedDto): Promise<Result<boolean, string>> {
|
async createEmployee(dto: EmployeeDetailedDto): Promise<Result<boolean, string>> {
|
||||||
const normalized_access = toBooleanFromString(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);
|
||||||
|
|
||||||
await this.prisma.$transaction(async (tx) => {
|
await this.prisma.$transaction(async (tx) => {
|
||||||
const user: Users = await tx.users.create({
|
const user: Users = await tx.users.create({
|
||||||
|
|
@ -41,7 +43,7 @@ export class EmployeesCreateService {
|
||||||
external_payroll_id: dto.external_payroll_id,
|
external_payroll_id: dto.external_payroll_id,
|
||||||
company_code: company_code,
|
company_code: company_code,
|
||||||
job_title: dto.job_title,
|
job_title: dto.job_title,
|
||||||
first_work_day: dto.first_work_day,
|
first_work_day: first_work_day,
|
||||||
is_supervisor: dto.is_supervisor,
|
is_supervisor: dto.is_supervisor,
|
||||||
supervisor_id: supervisor_id,
|
supervisor_id: supervisor_id,
|
||||||
schedule_preset_id: dto.preset_id,
|
schedule_preset_id: dto.preset_id,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user