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,
|
||||
salary: data.salary,
|
||||
phone: data.phone || null,
|
||||
gender: data.gender || null,
|
||||
gender: data.gender ? data.gender.toUpperCase() : null,
|
||||
startDate: data.startDate ? new Date(data.startDate) : new Date(),
|
||||
pfApplicable: data.pfApplicable,
|
||||
esiApplicable: data.esiApplicable,
|
||||
|
||||
@@ -98,10 +98,12 @@ router.post('/runs/:id/process', requireAuth, async (req: AuthRequest, res: Resp
|
||||
totalGross += calc.grossPay;
|
||||
totalNet += calc.netPay;
|
||||
totalDeductions += calc.totalDeductions;
|
||||
// Exclude totalDeductions — not a Payslip schema field
|
||||
const { totalDeductions: _td, ...payslipFields } = calc;
|
||||
return {
|
||||
payrollRunId: run.id,
|
||||
employeeId: emp.id,
|
||||
...calc,
|
||||
...payslipFields,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user