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 { export class ShiftDto {
start: string; date: string;
end : string; type: string;
start_time: string;
end_time : string;
is_approved: boolean; is_approved: boolean;
is_remote: boolean; is_remote: boolean;
} }

View File

@ -144,7 +144,6 @@ export class TimesheetsQueryService {
if(!timesheet) { if(!timesheet) {
return { return {
is_approved: false, is_approved: false,
is_remote: false,
start_day, start_day,
end_day, end_day,
label, 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"; import { DayExpensesDto, DetailedShifts, ShiftDto, TimesheetPeriodDto, WeekDto } from "../dtos/timesheet-period.dto";
//makes the strings indexes for arrays //makes the strings indexes for arrays
@ -33,8 +34,8 @@ const EXPENSE_TYPES = {
} as const; } as const;
//DB line types //DB line types
export type ShiftRow = { date: Date; start_time: Date; end_time: Date; is_approved?: boolean; type: string }; 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 }; export type ExpenseRow = { date: Date; amount: number; type: string; is_approved?: boolean; };
//helper functions //helper functions
export function toUTCDateOnly(date: Date | string): Date { export function toUTCDateOnly(date: Date | string): Date {
@ -154,9 +155,12 @@ export function buildWeek(
for (const shift of week_shifts) { for (const shift of week_shifts) {
const key = dayKeyFromDate(shift.date, true); const key = dayKeyFromDate(shift.date, true);
week.shifts[key].shifts.push({ week.shifts[key].shifts.push({
start: toTimeString(shift.start_time), date: toDateString(shift.date),
end: toTimeString(shift.end_time), type: shift.type,
start_time: toTimeString(shift.start_time),
end_time: toTimeString(shift.end_time),
is_approved: shift.is_approved ?? true, is_approved: shift.is_approved ?? true,
is_remote: shift.is_remote,
} as ShiftDto); } as ShiftDto);
day_times[key].push({ start: shift.start_time, end: shift.end_time}); day_times[key].push({ start: shift.start_time, end: shift.end_time});