fix: error relation
This commit is contained in:
parent
fb47a11712
commit
8ba4f23d14
1 changed files with 7 additions and 1 deletions
|
|
@ -514,6 +514,7 @@ export class EmployeeController extends Controller {
|
||||||
|
|
||||||
const listProvinceId = employeeCheckup?.reduce<string[]>((acc, cur) => {
|
const listProvinceId = employeeCheckup?.reduce<string[]>((acc, cur) => {
|
||||||
if (cur.provinceId && !acc.includes(cur.provinceId)) return acc.concat(cur.provinceId);
|
if (cur.provinceId && !acc.includes(cur.provinceId)) return acc.concat(cur.provinceId);
|
||||||
|
if (!cur.provinceId) cur.provinceId = null;
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
@ -658,7 +659,12 @@ export class EmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
await prisma.employeeHistory.createMany({
|
await prisma.employeeHistory.createMany({
|
||||||
data: historyEntries.map((v) => ({ ...v, masterId: employee.id })),
|
data: historyEntries.map((v) => ({
|
||||||
|
...v,
|
||||||
|
updatedByUserId: req.user.sub,
|
||||||
|
updatedBy: req.user.preferred_username,
|
||||||
|
masterId: employee.id,
|
||||||
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
return Object.assign(record, {
|
return Object.assign(record, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue