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