แก้ไขเก็บประวัติ

This commit is contained in:
kittapath 2024-09-04 21:20:50 +07:00
parent 88920d92e6
commit 4056a2aa7f
6 changed files with 19 additions and 58 deletions

View file

@ -62,11 +62,9 @@ import {
} from "../entities/ProfileEmployeeEmployment";
import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory";
import CallAPI from "../interfaces/call-api";
import { EmployeePosition } from "../entities/EmployeePosition";
import { ProfileInsignia } from "../entities/ProfileInsignia";
import { ProfileLeave } from "../entities/ProfileLeave";
import permission from "../interfaces/permission";
import { request } from "axios";
@Route("api/v1/org/profile-employee")
@Tags("ProfileEmployee")
@Security("bearerAuth")
@ -82,7 +80,6 @@ export class ProfileEmployeeController extends Controller {
private profileHistoryRepo = AppDataSource.getRepository(ProfileEmployeeHistory);
private posLevelRepo = AppDataSource.getRepository(EmployeePosLevel);
private posTypeRepo = AppDataSource.getRepository(EmployeePosType);
private positionRepository = AppDataSource.getRepository(EmployeePosition);
private provinceRepository = AppDataSource.getRepository(Province);
private districtRepository = AppDataSource.getRepository(District);
private subDistrict = AppDataSource.getRepository(SubDistrict);
@ -673,13 +670,12 @@ export class ProfileEmployeeController extends Controller {
}
Object.assign(record, body);
record.createdUserId = request.user.sub;
record.createdFullName = request.user.name;
record.createdAt = new Date();
record.lastUpdateUserId = request.user.sub;
record.lastUpdateFullName = request.user.name;
record.lastUpdatedAt = new Date();
record.dateRetire = calculateRetireDate(record.birthDate);
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
record.citizenId = Extension.CheckCitizen(record.citizenId);
record.employeeClass = record.employeeClass.toLocaleUpperCase();
await this.profileHistoryRepo.save(
Object.assign(new ProfileEmployeeHistory(), {
...record,
@ -2798,18 +2794,6 @@ export class ProfileEmployeeController extends Controller {
item.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
? null
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id);
const position =
posMaster == null ||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.positions == null ||
item.current_holders?.find((x) => x.orgRevisionId == findRevision.id)?.positions.length ==
0 ||
item.current_holders
.find((x) => x.orgRevisionId == findRevision.id)
?.positions?.find((position) => position.positionIsSelected == true) == null
? null
: item.current_holders
.find((x) => x.orgRevisionId == findRevision.id)
?.positions?.find((position) => position.positionIsSelected == true);
// const posExecutive =
// position == null ||
// item.current_holders
@ -2978,11 +2962,6 @@ export class ProfileEmployeeController extends Controller {
}
await this.profileRepo.save(profile);
const profileSalary = await this.salaryRepository.findOne({
where: { profileEmployeeId: id },
order: { createdAt: "DESC" },
});
return new HttpSuccess();
}
@ -3333,7 +3312,7 @@ export class ProfileEmployeeController extends Controller {
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
})
.then(async (x) => {
.then(async () => {
profile.statusTemp = "DONE";
profile.employeeClass = "PERM";
const _null: any = null;
@ -3346,7 +3325,7 @@ export class ProfileEmployeeController extends Controller {
positionId: profile.positionIdTemp,
profileId: profile.id,
})
.then(async (x) => {});
.then(async () => {});
}
}),
);