add notification expireDate passport, visa
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
parent
0affb5337f
commit
897ef335b4
4 changed files with 149 additions and 1 deletions
|
|
@ -606,7 +606,21 @@ export class TaskActionController extends Controller {
|
|||
return await prisma.$transaction(async (tx) => {
|
||||
const promises = body.map(async (v) => {
|
||||
const record = await tx.task.findFirst({
|
||||
include: { requestWorkStep: true },
|
||||
include: {
|
||||
requestWorkStep: {
|
||||
include: {
|
||||
requestWork: {
|
||||
include: {
|
||||
request: {
|
||||
include: {
|
||||
quotation: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
where: {
|
||||
step: v.step,
|
||||
requestWorkId: v.requestWorkId,
|
||||
|
|
@ -624,6 +638,20 @@ export class TaskActionController extends Controller {
|
|||
data: { userTaskStatus: UserTaskStatus.Restart },
|
||||
});
|
||||
}
|
||||
|
||||
if (v.taskStatus === TaskStatus.Failed) {
|
||||
const code = record.requestWorkStep.requestWork.request.quotation.code;
|
||||
const name = record.requestWorkStep.requestWork.request.quotation.workName;
|
||||
|
||||
await tx.notification.create({
|
||||
data: {
|
||||
title: "ใบรายการคำขอที่จัดการเกิดปัญหา / Task Failed",
|
||||
detail: `ใบรายการคำขอรหัส / code : ${code} - ${name} ใบรายการคำขอเกิดปัญหา`,
|
||||
receiverId: record.requestWorkStep.requestWork.request.quotation.updatedByUserId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return await tx.task.update({
|
||||
where: { id: record.id },
|
||||
data: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue