fix: ไฟล์แนบท้ายดาวน์โหลดไม่ได้
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m20s

This commit is contained in:
Adisak 2026-02-13 12:50:35 +07:00
parent 74b2694aef
commit a16ae79c7e

View file

@ -601,7 +601,7 @@ export async function PayloadSendNoti(commandId: string) {
where: {
id: commandId,
},
relations: ["commandType"],
relations: ["commandType", "commandRecives"],
});
if (!_command || !_command.commandType)
return "";
@ -615,19 +615,18 @@ export async function PayloadSendNoti(commandId: string) {
}
let attachments = {}
if (_command.commandType.isUploadAttachment === true) {
const _payloadAtt = {
name: _command && _command.commandType
? `เอกสารแนบท้ายคำสั่ง${_command.commandType.name}`
: "",
url: `${process.env.API_URL}/salary/file/ระบบออกคำสั่ง/แนบท้าย/${commandId}/แนบท้าย`,
const attachmentPayloads = _command.commandRecives.map((recive: any) => ({
name: `เอกสารแนบท้ายคำสั่ง${_command.commandType.name} (${recive.prefix}${recive.firstName} ${recive.lastName})`,
url: `${process.env.API_URL}/salary/file/ระบบออกคำสั่ง/แนบท้าย/${commandId}/${recive.citizenId}/แนบท้าย`,
isReport: true,
isTemplate: false,
}
}));
attachments = {
attachments: [_payload, _payloadAtt]
attachments: [_payload, ...attachmentPayloads]
};
}
else {
} else {
attachments = {
attachments: [_payload]
};