fix(timesheet): removed validation/transformation from ensureTimesheet and use the param Date format inside the function

This commit is contained in:
Matthieu Haineault 2025-10-31 08:50:13 -04:00
parent c0fbad006d
commit 9f0da467ae

View File

@ -178,11 +178,10 @@ export class GetTimesheetsOverviewService {
};
}
private ensureTimesheet = async (employee_id: number, start_date: Date | string) => {
const start = toDateFromString(start_date);
private ensureTimesheet = async (employee_id: number, start_date: Date) => {
let row = await this.prisma.timesheets.findFirst({
where: { employee_id, start_date: start },
where: { employee_id, start_date: start_date },
include: {
employee: { include: { user: true } },
shift: { include: { bank_code: true } },
@ -194,13 +193,13 @@ export class GetTimesheetsOverviewService {
await this.prisma.timesheets.create({
data: {
employee_id,
start_date: start,
start_date: start_date,
is_approved: false
},
});
row = await this.prisma.timesheets.findFirst({
where: { employee_id, start_date: start },
where: { employee_id, start_date: start_date },
include: {
employee: { include: { user: true } },
shift: { include: { bank_code: true } },