fix(shifts): commented unused service function
This commit is contained in:
parent
c0189dc61d
commit
4e48d98c0f
|
|
@ -250,7 +250,7 @@
|
|||
},
|
||||
"/timesheets": {
|
||||
"get": {
|
||||
"operationId": "TimesheetController_getTimesheetByIds",
|
||||
"operationId": "TimesheetController_getTimesheetByPayPeriod",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "year",
|
||||
|
|
|
|||
|
|
@ -24,37 +24,37 @@ export class ShiftsGetService {
|
|||
){}
|
||||
|
||||
//fetch a shift using shift_id and return all that shift's info
|
||||
async getShiftByShiftId(shift_ids: number[]): Promise<GetShiftDto[]> {
|
||||
if(!Array.isArray(shift_ids) || shift_ids.length === 0) return [];
|
||||
// async getShiftByShiftId(shift_ids: number[]): Promise<GetShiftDto[]> {
|
||||
// if(!Array.isArray(shift_ids) || shift_ids.length === 0) return [];
|
||||
|
||||
const rows = await this.prisma.shifts.findMany({
|
||||
where: { id: { in: shift_ids } },
|
||||
select: shift_select,
|
||||
});
|
||||
// const rows = await this.prisma.shifts.findMany({
|
||||
// where: { id: { in: shift_ids } },
|
||||
// select: shift_select,
|
||||
// });
|
||||
|
||||
if(rows.length !== shift_ids.length) {
|
||||
const found_ids = new Set(rows.map(row => row.id));
|
||||
const missing_ids = shift_ids.filter(id => !found_ids.has(id));
|
||||
throw new NotFoundException(`Shift(s) not found: ${ missing_ids.join(", ")}`);
|
||||
}
|
||||
// if(rows.length !== shift_ids.length) {
|
||||
// const found_ids = new Set(rows.map(row => row.id));
|
||||
// const missing_ids = shift_ids.filter(id => !found_ids.has(id));
|
||||
// throw new NotFoundException(`Shift(s) not found: ${ missing_ids.join(", ")}`);
|
||||
// }
|
||||
|
||||
const row_by_id = new Map(rows.map(row => [row.id, row]));
|
||||
// const row_by_id = new Map(rows.map(row => [row.id, row]));
|
||||
|
||||
return shift_ids.map((id) => {
|
||||
const shift = row_by_id.get(id)!;
|
||||
return {
|
||||
timesheet_id: shift.timesheet_id,
|
||||
type: shift.bank_code.type,
|
||||
date: toStringFromDate(shift.date),
|
||||
start_time: toStringFromHHmm(shift.start_time),
|
||||
end_time: toStringFromHHmm(shift.end_time),
|
||||
is_remote: shift.is_remote,
|
||||
is_approved: shift.is_approved,
|
||||
comment: shift.comment ?? undefined,
|
||||
} satisfies GetShiftDto;
|
||||
});
|
||||
// return shift_ids.map((id) => {
|
||||
// const shift = row_by_id.get(id)!;
|
||||
// return {
|
||||
// timesheet_id: shift.timesheet_id,
|
||||
// type: shift.bank_code.type,
|
||||
// date: toStringFromDate(shift.date),
|
||||
// start_time: toStringFromHHmm(shift.start_time),
|
||||
// end_time: toStringFromHHmm(shift.end_time),
|
||||
// is_remote: shift.is_remote,
|
||||
// is_approved: shift.is_approved,
|
||||
// comment: shift.comment ?? undefined,
|
||||
// } satisfies GetShiftDto;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user