fix: error trying to create relation in create many
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
This commit is contained in:
parent
bfc2608af4
commit
dfe7bd16d8
1 changed files with 65 additions and 45 deletions
|
|
@ -456,15 +456,19 @@ export class RequestDataActionController extends Controller {
|
|||
data: { quotationStatus: QuotationStatus.Canceled, urgent: false },
|
||||
})
|
||||
.then(async (res) => {
|
||||
await tx.notification.createMany({
|
||||
data: res.map((v) => ({
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Canceled",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
})),
|
||||
});
|
||||
await Promise.all(
|
||||
res.map((v) =>
|
||||
tx.notification.create({
|
||||
data: {
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Canceled",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
}),
|
||||
tx.taskOrder
|
||||
.updateManyAndReturn({
|
||||
|
|
@ -665,15 +669,19 @@ export class RequestDataActionController extends Controller {
|
|||
data: { quotationStatus: QuotationStatus.Canceled, urgent: false },
|
||||
})
|
||||
.then(async (res) => {
|
||||
await tx.notification.createMany({
|
||||
data: res.map((v) => ({
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Canceled",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
})),
|
||||
});
|
||||
await Promise.all(
|
||||
res.map((v) =>
|
||||
tx.notification.create({
|
||||
data: {
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Canceled",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
}),
|
||||
tx.taskOrder.updateMany({
|
||||
where: {
|
||||
|
|
@ -771,15 +779,19 @@ export class RequestDataActionController extends Controller {
|
|||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
await tx.notification.createMany({
|
||||
data: res.map((v) => ({
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Completed",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
})),
|
||||
});
|
||||
await Promise.all(
|
||||
res.map((v) =>
|
||||
tx.notification.create({
|
||||
data: {
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Completed",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const token = await this.#getLineToken();
|
||||
if (!token) return;
|
||||
|
|
@ -1185,15 +1197,19 @@ export class RequestListController extends Controller {
|
|||
data: { quotationStatus: QuotationStatus.Canceled, urgent: false },
|
||||
})
|
||||
.then(async (res) => {
|
||||
await tx.notification.createMany({
|
||||
data: res.map((v) => ({
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Canceled",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
})),
|
||||
});
|
||||
await Promise.all(
|
||||
res.map((v) =>
|
||||
tx.notification.create({
|
||||
data: {
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Canceled",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
}),
|
||||
tx.taskOrder.updateMany({
|
||||
where: {
|
||||
|
|
@ -1301,15 +1317,19 @@ export class RequestListController extends Controller {
|
|||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
await tx.notification.createMany({
|
||||
data: res.map((v) => ({
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Completed",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
})),
|
||||
});
|
||||
await Promise.all(
|
||||
res.map((v) =>
|
||||
tx.notification.create({
|
||||
data: {
|
||||
title: "สถานะใบเสนอราคาเปลี่ยนแปลง / Quotation Status Updated",
|
||||
detail: "รหัส / code : " + v.code + " Completed",
|
||||
receiverId: v.createdByUserId,
|
||||
registeredBranchId: v.registeredBranchId,
|
||||
groupReceiver: { create: { name: "document_checker" } },
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
const token = await this.#getLineToken();
|
||||
if (!token) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue