fix(employees): added 1st and last work day to employee list return

This commit is contained in:
Matthieu Haineault 2025-12-04 17:09:38 -05:00
parent 2faecf8e30
commit b18ce4972c

View File

@ -3,7 +3,7 @@ import { PrismaService } from "src/prisma/prisma.service";
import { Modules, toStringFromBoolean } from "src/common/mappers/module-access.mapper";
import { EmailToIdResolver } from "src/common/mappers/email-id.mapper";
import { toStringFromDate } from "src/common/utils/date-utils";
import { toDateFromString, toStringFromDate } from "src/common/utils/date-utils";
import { Result } from "src/common/errors/result-error.factory";
import { toStringFromCompanyCode } from "src/identity-and-account/employees/employee.utils";
@ -40,6 +40,8 @@ export class EmployeesGetService {
job_title: true,
company_code: true,
external_payroll_id: true,
first_work_day: true,
last_work_day: true,
}
}).then(rows => rows.map(r => ({
@ -52,6 +54,8 @@ export class EmployeesGetService {
employee_full_name: `${r.user.first_name} ${r.user.last_name}`,
is_supervisor: r.is_supervisor,
supervisor_full_name: `${r.supervisor?.user.first_name} ${r.supervisor?.user.last_name}`,
first_work_day: toStringFromDate(r.first_work_day),
last_work_day: r.last_work_day ? toStringFromDate(r.last_work_day) : null,
})));
return { success: true, data: employee_list };
};