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