feat: notify quotation status change
This commit is contained in:
parent
071262a85a
commit
2697b4f6e0
4 changed files with 192 additions and 103 deletions
|
|
@ -785,19 +785,31 @@ export class TaskActionController extends Controller {
|
|||
where: { id: { in: completed } },
|
||||
data: { requestDataStatus: RequestDataStatus.Completed },
|
||||
});
|
||||
await tx.quotation.updateMany({
|
||||
where: {
|
||||
quotationStatus: {
|
||||
notIn: [QuotationStatus.Canceled, QuotationStatus.ProcessComplete],
|
||||
},
|
||||
requestData: {
|
||||
every: {
|
||||
requestDataStatus: { in: [RequestDataStatus.Canceled, RequestDataStatus.Completed] },
|
||||
await tx.quotation
|
||||
.updateManyAndReturn({
|
||||
where: {
|
||||
quotationStatus: {
|
||||
notIn: [QuotationStatus.Canceled, QuotationStatus.ProcessComplete],
|
||||
},
|
||||
requestData: {
|
||||
every: {
|
||||
requestDataStatus: {
|
||||
in: [RequestDataStatus.Canceled, RequestDataStatus.Completed],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
data: { quotationStatus: QuotationStatus.ProcessComplete, urgent: false },
|
||||
});
|
||||
data: { quotationStatus: QuotationStatus.ProcessComplete, urgent: false },
|
||||
})
|
||||
.then(async (res) => {
|
||||
await tx.notification.createMany({
|
||||
data: res.map((v) => ({
|
||||
title: "Quotation Status Updated",
|
||||
detail: v.code + "Completed",
|
||||
receiverId: v.createdByUserId,
|
||||
})),
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue