fix(timesheet): added is_remote

This commit is contained in:
Matthieu Haineault 2025-09-09 08:19:50 -04:00
parent 557aed645d
commit 0fb6465c27
3 changed files with 12 additions and 7 deletions

View File

@ -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;
}

View File

@ -144,7 +144,6 @@ export class TimesheetsQueryService {
if(!timesheet) {
return {
is_approved: false,
is_remote: false,
start_day,
end_day,
label,

View File

@ -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});