check commandType.isSalary

This commit is contained in:
Bright 2024-12-10 16:03:40 +07:00
parent 426239e8d8
commit 826337c8d7

View file

@ -943,6 +943,7 @@ export class CommandController extends Controller {
await new permission().PermissionGet(request, "COMMAND"); await new permission().PermissionGet(request, "COMMAND");
const command = await this.commandRepository.findOne({ const command = await this.commandRepository.findOne({
where: { id }, where: { id },
relations: ["commandType"]
}); });
if (!command) { if (!command) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
@ -955,6 +956,7 @@ export class CommandController extends Controller {
isDraft: command.isDraft, isDraft: command.isDraft,
isSign: command.isSign, isSign: command.isSign,
isAttachment: command.isAttachment, isAttachment: command.isAttachment,
isSalary: command.commandType ? command.commandType.isSalary : null,
}; };
return new HttpSuccess(_command); return new HttpSuccess(_command);
} }