noti report
This commit is contained in:
parent
5bf3beb30b
commit
d4437c8640
1 changed files with 24 additions and 1 deletions
|
|
@ -1004,7 +1004,7 @@ export class CommandController extends Controller {
|
|||
) {
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["commandType", "commandRecives"],
|
||||
relations: ["commandType", "commandRecives", "commandSends", "commandSends.commandSendCCs"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
|
|
@ -1036,6 +1036,29 @@ export class CommandController extends Controller {
|
|||
.catch((error) => {
|
||||
console.error("Error calling API:", error);
|
||||
});
|
||||
let _profiles =
|
||||
command && command.commandSends.length > 0
|
||||
? command.commandSends
|
||||
.filter((x) => x.profileId != null)
|
||||
.map((x) => ({
|
||||
receiverUserId: x.profileId,
|
||||
notiLink: "",
|
||||
isSendMail: x.commandSendCCs.map((x) => x.name == "EMAIL").length > 0 ? true : false,
|
||||
isSendInbox: x.commandSendCCs.map((x) => x.name == "INBOX").length > 0 ? true : false,
|
||||
isSendNotification: true,
|
||||
}))
|
||||
: [];
|
||||
|
||||
await new CallAPI()
|
||||
.PostData(request, "/placement/noti/profiles", {
|
||||
subject: `${command.issue}`,
|
||||
body: `${command.issue}`,
|
||||
receiverUserIds: _profiles,
|
||||
payload: "", //แนบไฟล์
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error calling API:", error);
|
||||
});
|
||||
if (
|
||||
new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) <
|
||||
new Date(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue