fix: error create many with relation
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Methapon2001 2025-07-22 10:35:48 +07:00
parent c34af75bad
commit c7183887c9

View file

@ -925,14 +925,18 @@ export class TaskActionController extends Controller {
data: { requestDataStatus: RequestDataStatus.Completed },
})
.then(async (res) => {
await tx.notification.createMany({
data: res.map((v) => ({
title: "รายการคำขอเสร็จสิ้น / Request Complete",
await Promise.all(
res.map((v) =>
tx.notification.create({
data: {
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
detail: "รหัส / code : " + v.code + " Completed",
receiverId: v.quotation.createdByUserId,
groupReceiver: { create: { name: "document_checker" } },
})),
});
},
}),
),
);
});
await tx.quotation
.updateManyAndReturn({
@ -973,14 +977,18 @@ export class TaskActionController extends Controller {
},
})
.then(async (res) => {
await tx.notification.createMany({
data: res.map((v) => ({
await Promise.all(
res.map((v) =>
tx.notification.create({
data: {
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
detail: "รหัส / code : " + v.code + " Completed",
receiverId: v.createdByUserId,
groupReceiver: { create: { name: "document_checker" } },
})),
});
},
}),
),
);
const token = await this.#getLineToken();