api คำขอแก้ไข

This commit is contained in:
Kittapath 2024-07-19 11:08:47 +07:00
parent 0696672f86
commit 85c6093970
8 changed files with 546 additions and 30 deletions

View file

@ -36,6 +36,7 @@ import {
calculateRetireDate,
calculateRetireLaw,
calculateRetireYear,
removeProfileInOrganize,
} from "../interfaces/utils";
import { RequestWithUser } from "../middlewares/user";
import { Position } from "../entities/Position";
@ -1451,6 +1452,7 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id);
profile.isLeave = true;
profile.leaveReason =
"คำสั่งให้ข้าราชการออกจากราชการเพราะผลการทดลองปฏิบัติหน้าที่ราชการต่ำกว่ามาตรฐานที่กำหนด";
@ -1523,6 +1525,7 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id);
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย ปลดออกจากราชการ";
profile.dateLeave = dateLeave_;
@ -1594,6 +1597,7 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id);
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย ไล่ออกจากราชการ";
profile.dateLeave = dateLeave_;
@ -1679,6 +1683,7 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id);
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย พักจากราชการ";
profile.dateLeave = dateLeave_;
@ -1750,6 +1755,7 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id);
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการไว้ก่อน";
profile.dateLeave = dateLeave_;
@ -4879,6 +4885,9 @@ export class ProfileController extends Controller {
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const _null: any = null;
profile.isLeave = requestBody.isLeave;
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id);
}
if (requestBody.leaveReason != undefined && requestBody.leaveReason != null) {
profile.leaveReason = requestBody.leaveReason;
} else {
@ -4890,11 +4899,10 @@ export class ProfileController extends Controller {
profile.dateLeave = _null;
}
await this.profileRepo.save(profile);
const profileSalary = await this.salaryRepository.findOne({
where: { profileId: id },
order: { createdAt: "DESC" },
});
// const profileSalary = await this.salaryRepository.findOne({
// where: { profileId: id },
// order: { createdAt: "DESC" },
// });
return new HttpSuccess();
}