fix: transaction close before action

This commit is contained in:
Methapon Metanipat 2024-11-25 14:32:49 +07:00
parent aa622afc9f
commit 2caf197542

View file

@ -178,7 +178,8 @@ export async function initEmploymentOffice() {
await tx.employmentOffice.deleteMany({
where: { provinceId: province.id, district: { none: {} } },
});
return Object.entries(special[province.id]).map(([key, val]) => {
return await Promise.all(
Object.entries(special[province.id]).map(async ([key, val]) => {
const id = province.id + "-" + key.padStart(2, "0");
return tx.employmentOffice.upsert({
where: { id },
@ -208,7 +209,8 @@ export async function initEmploymentOffice() {
},
},
});
});
}),
);
}
return tx.employmentOffice.upsert({