fix(pay-period): minor fix to pay period handling, was returning pay-year of date from request rather than pay-year from pay period in db

This commit is contained in:
Nicolas Drolet 2025-12-15 09:01:37 -05:00
parent 6f3acde71b
commit 0c77df41c6
2 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,8 @@ export function mapPayPeriodToDto(row: PayPeriods): PayPeriodDto {
period_start: toDateString(row.period_start),
period_end: toDateString(row.period_end),
payday:pay,
pay_year: new Date(pay).getFullYear(),
// pay_year: new Date(pay).getFullYear(),
pay_year: row.pay_year,
label: `${start}.${end}`,
};
}

View File

@ -18,7 +18,7 @@ export class SchedulePresetsGetService {
orderBy: [{ is_default: 'desc' }, { name: 'asc' }],
include: {
shifts: {
orderBy: [{ week_day: 'asc', start_time: 'asc' }],
orderBy: [{ week_day: 'asc'}, {start_time: 'asc' }],
include: { bank_code: { select: { type: true } } },
},
},
@ -38,6 +38,7 @@ export class SchedulePresetsGetService {
type: shift.bank_code?.type,
})),
}));
return { success: true, data: response };
} catch (error) {
return { success: false, error: `SCHEDULE_PRESET_NOT_FOUND` };