diff --git a/src/modules/timesheets/dtos/timesheet-period.dto.ts b/src/modules/timesheets/dtos/timesheet-period.dto.ts index a8a74bf..b948f4d 100644 --- a/src/modules/timesheets/dtos/timesheet-period.dto.ts +++ b/src/modules/timesheets/dtos/timesheet-period.dto.ts @@ -1,6 +1,8 @@ export class ShiftDto { - start: string; - end : string; + date: string; + type: string; + start_time: string; + end_time : string; is_approved: boolean; is_remote: boolean; } diff --git a/src/modules/timesheets/services/timesheets-query.service.ts b/src/modules/timesheets/services/timesheets-query.service.ts index 0a545c8..1849e16 100644 --- a/src/modules/timesheets/services/timesheets-query.service.ts +++ b/src/modules/timesheets/services/timesheets-query.service.ts @@ -144,7 +144,6 @@ export class TimesheetsQueryService { if(!timesheet) { return { is_approved: false, - is_remote: false, start_day, end_day, label, diff --git a/src/modules/timesheets/utils/timesheet.helpers.ts b/src/modules/timesheets/utils/timesheet.helpers.ts index c94d64d..eadae40 100644 --- a/src/modules/timesheets/utils/timesheet.helpers.ts +++ b/src/modules/timesheets/utils/timesheet.helpers.ts @@ -1,3 +1,4 @@ +import { toDateString } from "src/modules/pay-periods/utils/pay-year.util"; import { DayExpensesDto, DetailedShifts, ShiftDto, TimesheetPeriodDto, WeekDto } from "../dtos/timesheet-period.dto"; //makes the strings indexes for arrays @@ -33,8 +34,8 @@ const EXPENSE_TYPES = { } as const; //DB line types -export type ShiftRow = { date: Date; start_time: Date; end_time: Date; is_approved?: boolean; type: string }; -export type ExpenseRow = { date: Date; amount: number; type: string; is_approved?: boolean }; +export type ShiftRow = { date: Date; start_time: Date; end_time: Date; is_approved?: boolean; is_remote: boolean; type: string }; +export type ExpenseRow = { date: Date; amount: number; type: string; is_approved?: boolean; }; //helper functions export function toUTCDateOnly(date: Date | string): Date { @@ -154,9 +155,12 @@ export function buildWeek( for (const shift of week_shifts) { const key = dayKeyFromDate(shift.date, true); week.shifts[key].shifts.push({ - start: toTimeString(shift.start_time), - end: toTimeString(shift.end_time), + date: toDateString(shift.date), + type: shift.type, + start_time: toTimeString(shift.start_time), + end_time: toTimeString(shift.end_time), is_approved: shift.is_approved ?? true, + is_remote: shift.is_remote, } as ShiftDto); day_times[key].push({ start: shift.start_time, end: shift.end_time});