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

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

@ -81,7 +81,6 @@ export class ProfileEmployeeTempController 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);
@ -670,13 +669,12 @@ export class ProfileEmployeeTempController 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,
@ -2703,18 +2701,6 @@ export class ProfileEmployeeTempController 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
@ -2883,11 +2869,6 @@ export class ProfileEmployeeTempController extends Controller {
}
await this.profileRepo.save(profile);
const profileSalary = await this.salaryRepository.findOne({
where: { profileEmployeeId: id },
order: { createdAt: "DESC" },
});
return new HttpSuccess();
}
@ -3206,7 +3187,7 @@ export class ProfileEmployeeTempController extends Controller {
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
})
.then(async (x) => {
.then(async () => {
profile.statusTemp = "DONE";
profile.employeeClass = "PERM";
const _null: any = null;
@ -3219,7 +3200,7 @@ export class ProfileEmployeeTempController extends Controller {
positionId: profile.positionIdTemp,
profileId: profile.id,
})
.then(async (x) => {});
.then(async () => {});
}
}),
);