refactor(shifts): removed return statement of Delete shift function
This commit is contained in:
parent
77e10c67c7
commit
9ad4e63485
|
|
@ -36,7 +36,7 @@
|
||||||
"seed:12": "tsx prisma/mock-seeds-scripts/12-expenses.ts",
|
"seed:12": "tsx prisma/mock-seeds-scripts/12-expenses.ts",
|
||||||
"seed:13": "tsx prisma/mock-seeds-scripts/13-expenses-archive.ts",
|
"seed:13": "tsx prisma/mock-seeds-scripts/13-expenses-archive.ts",
|
||||||
"seed:14": "tsx prisma/mock-seeds-scripts/14-oauth-sessions.ts",
|
"seed:14": "tsx prisma/mock-seeds-scripts/14-oauth-sessions.ts",
|
||||||
"seed:all": "npm run seed:01 && npm run seed:02 && npm run seed:03 && npm run seed:04 && npm run seed:05 && npm run seed:06 && npm run seed:07 && npm run seed:08 && npm run seed:09 && npm run seed:10 && npm run seed:11 && npm run seed:12 && npm run seed:13 && npm run seed:14",
|
"seed:all": "npm run seed:01 && npm run seed:02 && npm run seed:03 && npm run seed:09 && npm run seed:10 && npm run seed:12 && npm run seed:14",
|
||||||
"db:reseed": "npm run db:reset && npm run seed:all"
|
"db:reseed": "npm run db:reset && npm run seed:all"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ export class ShiftsCommandService extends BaseApprovalService<Shifts> {
|
||||||
email: string,
|
email: string,
|
||||||
date_iso: string,
|
date_iso: string,
|
||||||
dto: UpsertShiftDto,
|
dto: UpsertShiftDto,
|
||||||
): Promise<{ day: DayShiftResponse[]; }>{
|
){
|
||||||
return this.prisma.$transaction(async (tx) => {
|
return this.prisma.$transaction(async (tx) => {
|
||||||
const date_only = toDateOnly(date_iso); //converts to Date format
|
const date_only = toDateOnly(date_iso); //converts to Date format
|
||||||
const employee_id = await this.emailResolver.findIdByEmail(email);
|
const employee_id = await this.emailResolver.findIdByEmail(email);
|
||||||
|
|
@ -185,8 +185,6 @@ export class ShiftsCommandService extends BaseApprovalService<Shifts> {
|
||||||
await tx.shifts.delete({ where: { id: existing.id } });
|
await tx.shifts.delete({ where: { id: existing.id } });
|
||||||
|
|
||||||
await this.helpersService.afterWriteOvertimeAndLog(tx, employee_id, date_only);
|
await this.helpersService.afterWriteOvertimeAndLog(tx, employee_id, date_only);
|
||||||
const fresh_shift = await this.helpersService.getDayShifts(tx, timesheet.id, date_only);
|
|
||||||
return { day: await this.helpersService.mapDay(fresh_shift)};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user