Merge branch 'develop' into develop-Bright
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m33s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m33s
This commit is contained in:
commit
866afe5ee1
5 changed files with 186 additions and 171 deletions
|
|
@ -2386,27 +2386,27 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Get("history/user")
|
||||
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: request.user.sub }
|
||||
where: { keycloak: request.user.sub },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const profileHistory = await this.profileHistoryRepo.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
order: { createdAt: "ASC" }
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
||||
|
||||
if (profileHistory.length == 0) {
|
||||
await this.profileHistoryRepo.save(
|
||||
Object.assign(new ProfileEmployeeHistory(), {
|
||||
...profile,
|
||||
birthDateOld: profile?.birthDate,
|
||||
profileEmployeeId: profile.id,
|
||||
id: undefined
|
||||
id: undefined,
|
||||
}),
|
||||
);
|
||||
const firstRecord = await this.profileHistoryRepo.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
order: { createdAt: "ASC" }
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(firstRecord);
|
||||
}
|
||||
|
|
@ -3303,27 +3303,27 @@ export class ProfileEmployeeController extends Controller {
|
|||
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); ไม่แน่ใจEMPปิดไว้ก่อน;
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id }
|
||||
where: { id: id },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const profileHistory = await this.profileHistoryRepo.find({
|
||||
where: { profileEmployeeId: id },
|
||||
order: { createdAt: "ASC" }
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
||||
|
||||
if (profileHistory.length == 0) {
|
||||
await this.profileHistoryRepo.save(
|
||||
Object.assign(new ProfileEmployeeHistory(), {
|
||||
...profile,
|
||||
birthDateOld: profile?.birthDate,
|
||||
profileEmployeeId: id,
|
||||
id: undefined
|
||||
id: undefined,
|
||||
}),
|
||||
);
|
||||
const firstRecord = await this.profileHistoryRepo.find({
|
||||
where: { profileEmployeeId: id },
|
||||
order: { createdAt: "ASC" }
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(firstRecord);
|
||||
}
|
||||
|
|
@ -5546,7 +5546,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
].filter(Boolean);
|
||||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
PostRetireToExprofile(
|
||||
request,
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue