แก้ไขเก็บประวัติ
This commit is contained in:
parent
88920d92e6
commit
4056a2aa7f
6 changed files with 19 additions and 58 deletions
|
|
@ -94,7 +94,7 @@ export class ProfileAddressController extends Controller {
|
|||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
|
|
@ -135,7 +135,7 @@ export class ProfileAddressController extends Controller {
|
|||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
|
|
@ -139,7 +139,7 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
|
|
@ -139,7 +139,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
|||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
|
|
|
|||
|
|
@ -2389,11 +2389,12 @@ export class ProfileController extends Controller {
|
|||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
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);
|
||||
await this.profileHistoryRepo.save(
|
||||
Object.assign(new ProfileHistory(), {
|
||||
...record,
|
||||
|
|
|
|||
|
|
@ -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 () => {});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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 () => {});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue