fix: exclude totalDeductions from Prisma createMany, normalize gender to uppercase

This commit is contained in:
BetterHuman
2026-05-06 04:34:01 +00:00
parent 2b8854130a
commit 4d203ca3dc
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -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,
+3 -1
View File
@@ -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,
};
});