feat(paid_time_off): added last_updated to manipulations bank updates
This commit is contained in:
parent
7e9dbe5b3d
commit
5d6f6bfd0a
|
|
@ -39,7 +39,10 @@ export class BankedHoursService {
|
|||
if (type === 'BANKING') {
|
||||
const new_balance = await tx.paidTimeOff.update({
|
||||
where: { employee_id: employee.id },
|
||||
data: { banked_hours: { increment: asked_hours } },
|
||||
data: {
|
||||
banked_hours: { increment: asked_hours },
|
||||
last_updated: new Date(),
|
||||
},
|
||||
select: { banked_hours: true },
|
||||
});
|
||||
return { success: true, data: (new_balance.banked_hours).toNumber() } as Result<number, string>;
|
||||
|
|
@ -52,7 +55,10 @@ export class BankedHoursService {
|
|||
}
|
||||
await tx.paidTimeOff.update({
|
||||
where: { employee_id: employee.id },
|
||||
data: { banked_hours: { decrement: asked_hours } },
|
||||
data: {
|
||||
banked_hours: { decrement: asked_hours },
|
||||
last_updated: new Date(),
|
||||
},
|
||||
select: { banked_hours: true },
|
||||
});
|
||||
return { success: true, data: asked_hours } as Result<number, string>;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,10 @@ export class SickLeaveService {
|
|||
} else {
|
||||
await tx.paidTimeOff.update({
|
||||
where: { employee_id: employee.id },
|
||||
data: { banked_hours: { decrement: asked_hours } },
|
||||
data: {
|
||||
banked_hours: { decrement: asked_hours },
|
||||
last_updated: new Date(),
|
||||
},
|
||||
select: { banked_hours: true },
|
||||
});
|
||||
return { success: true, data: asked_hours } as Result<number, string>;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ export class VacationService {
|
|||
where: { employee_id: employee_id, vacation_hours: { gte: asked_hours } },
|
||||
data: {
|
||||
vacation_hours: { decrement: asked_hours },
|
||||
last_updated: new Date(),
|
||||
},
|
||||
});
|
||||
//returns asked hours if enough hours are left in the bank
|
||||
|
|
|
|||
|
|
@ -69,7 +69,10 @@ export class PaidTimeOFfBankHoursService {
|
|||
|
||||
await this.prisma.paidTimeOff.update({
|
||||
where: { employee_id },
|
||||
data: { [config.field]: { [operation]: hours } },
|
||||
data: {
|
||||
[config.field]: { [operation]: hours },
|
||||
last_updated: new Date(),
|
||||
},
|
||||
});
|
||||
return { success: true, data: true };
|
||||
} catch (error) {
|
||||
|
|
@ -88,6 +91,7 @@ export class PaidTimeOFfBankHoursService {
|
|||
where: { employee_id },
|
||||
data: {
|
||||
[config.field]: { [config.operation]: ajusted_hours },
|
||||
last_updated: new Date(),
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user