From 2936b84b47a8aae7d5856601307e08d8d17ed952 Mon Sep 17 00:00:00 2001 From: Nic D Date: Mon, 23 Feb 2026 14:36:12 -0500 Subject: [PATCH] fix(paid-time-off): add expected daily hours to timesheet output. --- .../services/timesheet-employee-overview.service.ts | 11 +++++++++-- src/time-and-attendance/timesheets/timesheet.dto.ts | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts b/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts index d1341f8..716cfe1 100644 --- a/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts +++ b/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts @@ -54,7 +54,7 @@ export class GetTimesheetsOverviewService { //find user infos using the employee_id const employee = await this.prisma.employees.findUnique({ where: { id: employee_id.data }, - include: { schedule_preset: true, user: true }, + select: { daily_expected_hours: true, schedule_preset: true, user: true }, }); if (!employee) return { success: false, error: `EMPLOYEE_NOT_FOUND` } @@ -68,7 +68,14 @@ export class GetTimesheetsOverviewService { const timesheets = await Promise.all(rows.map((timesheet) => mapOneTimesheet(timesheet))); if (!timesheets) return { success: false, error: 'INVALID_TIMESHEET' } - return { success: true, data: { has_preset_schedule, employee_fullname, timesheets } }; + const data: Timesheets = { + has_preset_schedule, + employee_fullname, + daily_expected_hours: employee.daily_expected_hours, + timesheets, + } + + return { success: true, data }; } catch (error) { console.error(error); return { success: false, error: 'TIMESHEET_NOT_FOUND' } diff --git a/src/time-and-attendance/timesheets/timesheet.dto.ts b/src/time-and-attendance/timesheets/timesheet.dto.ts index 0f5682a..56e5acd 100644 --- a/src/time-and-attendance/timesheets/timesheet.dto.ts +++ b/src/time-and-attendance/timesheets/timesheet.dto.ts @@ -11,6 +11,7 @@ export class TimesheetEntity { export class Timesheets { @IsBoolean() has_preset_schedule: boolean; @IsString() employee_fullname: string; + @IsInt() daily_expected_hours: number; @Type(() => Timesheet) timesheets: Timesheet[]; }