fix: transaction close before action
This commit is contained in:
parent
aa622afc9f
commit
2caf197542
1 changed files with 29 additions and 27 deletions
|
|
@ -178,7 +178,8 @@ export async function initEmploymentOffice() {
|
||||||
await tx.employmentOffice.deleteMany({
|
await tx.employmentOffice.deleteMany({
|
||||||
where: { provinceId: province.id, district: { none: {} } },
|
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");
|
const id = province.id + "-" + key.padStart(2, "0");
|
||||||
return tx.employmentOffice.upsert({
|
return tx.employmentOffice.upsert({
|
||||||
where: { id },
|
where: { id },
|
||||||
|
|
@ -208,7 +209,8 @@ export async function initEmploymentOffice() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tx.employmentOffice.upsert({
|
return tx.employmentOffice.upsert({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue