ออกคำสั่ง

This commit is contained in:
kittapath 2024-10-04 15:35:14 +07:00
parent b9bc5b1298
commit e0672ceca0
3 changed files with 656 additions and 18 deletions

View file

@ -5746,26 +5746,14 @@ export class ProfileController extends Controller {
where: { id: id },
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const _null: any = null;
profile.isLeave = requestBody.isLeave;
profile.leaveReason = requestBody.leaveReason;
profile.dateLeave = requestBody.dateLeave;
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id, "OFFICER");
}
if (requestBody.leaveReason != undefined && requestBody.leaveReason != null) {
profile.leaveReason = requestBody.leaveReason;
} else {
profile.leaveReason = _null;
}
if (requestBody.dateLeave != undefined && requestBody.dateLeave != null) {
profile.dateLeave = requestBody.dateLeave;
} else {
profile.dateLeave = _null;
}
await this.profileRepo.save(profile);
// const profileSalary = await this.salaryRepository.findOne({
// where: { profileId: id },
// order: { createdAt: "DESC" },
// });
return new HttpSuccess();
}