no message

This commit is contained in:
kittapath 2024-10-29 09:38:06 +07:00
parent 08706f57ed
commit 049a0299de

View file

@ -156,6 +156,39 @@ export class WorkflowController extends Controller {
}),
);
const _workflow = await this.workflowRepo.findOne({
where: { id: workflow.id },
relations: ["stateOperatorUsers"],
});
if (!_workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
const _state = await this.stateRepo.findOne({
where: {
id: _workflow.stateId,
},
relations: ["stateOperators"],
});
if (!_state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
let profileNow = _workflow.stateOperatorUsers
.filter((x) => _state.stateOperators.map((s) => s.operator).includes(x.operator))
.map((x) => ({
receiverUserId: x.profile,
notiLink: "",
}));
await new CallAPI()
.PostData(req, "/placement/noti/profiles", {
subject: `รายการถูกส่ง`,
body: `รายการถูกส่ง`,
receiverUserIds: profileNow,
payload: "", //แนบไฟล์
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.catch((error) => {
console.error("Error calling API:", error);
});
return new HttpSuccess();
}