fix: exclude totalDeductions from Prisma createMany, normalize gender to uppercase
This commit is contained in:
@@ -168,7 +168,7 @@ router.post('/', requireAuth, validate(createEmployeeSchema), async (req: AuthRe
|
|||||||
employmentType: data.employmentType,
|
employmentType: data.employmentType,
|
||||||
salary: data.salary,
|
salary: data.salary,
|
||||||
phone: data.phone || null,
|
phone: data.phone || null,
|
||||||
gender: data.gender || null,
|
gender: data.gender ? data.gender.toUpperCase() : null,
|
||||||
startDate: data.startDate ? new Date(data.startDate) : new Date(),
|
startDate: data.startDate ? new Date(data.startDate) : new Date(),
|
||||||
pfApplicable: data.pfApplicable,
|
pfApplicable: data.pfApplicable,
|
||||||
esiApplicable: data.esiApplicable,
|
esiApplicable: data.esiApplicable,
|
||||||
|
|||||||
@@ -98,10 +98,12 @@ router.post('/runs/:id/process', requireAuth, async (req: AuthRequest, res: Resp
|
|||||||
totalGross += calc.grossPay;
|
totalGross += calc.grossPay;
|
||||||
totalNet += calc.netPay;
|
totalNet += calc.netPay;
|
||||||
totalDeductions += calc.totalDeductions;
|
totalDeductions += calc.totalDeductions;
|
||||||
|
// Exclude totalDeductions — not a Payslip schema field
|
||||||
|
const { totalDeductions: _td, ...payslipFields } = calc;
|
||||||
return {
|
return {
|
||||||
payrollRunId: run.id,
|
payrollRunId: run.id,
|
||||||
employeeId: emp.id,
|
employeeId: emp.id,
|
||||||
...calc,
|
...payslipFields,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user