diff --git a/src/interfaces/utils.ts b/src/interfaces/utils.ts index cbd1b00b..cf86f369 100644 --- a/src/interfaces/utils.ts +++ b/src/interfaces/utils.ts @@ -581,9 +581,25 @@ export async function PayloadSendNoti(commandId: string) { isReport: true, isTemplate: false, } - const attachments = { - attachments: [_payload] - }; + let attachments = {} + if (_command.commandType.isUploadAttachment === true) { + const _payloadAtt = { + name: _command && _command.commandType + ? `เอกสารแนบท้ายคำสั่ง${_command.commandType.name}` + : "", + url: `${process.env.API_URL}/salary/file/ระบบออกคำสั่ง/แนบท้าย/${commandId}/แนบท้าย`, + isReport: true, + isTemplate: false, + } + attachments = { + attachments: [_payload, _payloadAtt] + }; + } + else { + attachments = { + attachments: [_payload] + }; + } return JSON.stringify(attachments); }