tuning api (ตัด profileSalary เส้นที่ไม่ได้ใช้งาน)
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m8s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m8s
This commit is contained in:
parent
ca433d5711
commit
987f8ef81a
1 changed files with 211 additions and 116 deletions
|
|
@ -4122,16 +4122,28 @@ export class OrganizationDotnetController extends Controller {
|
||||||
async getAllProfileByKeycloak(@Path() keycloakId: string) {
|
async getAllProfileByKeycloak(@Path() keycloakId: string) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { keycloak: keycloakId },
|
where: { keycloak: keycloakId },
|
||||||
relations: [
|
// relations: [
|
||||||
"profileSalary",
|
// "profileSalary",
|
||||||
"profileEducations",
|
// "profileEducations",
|
||||||
"current_holders",
|
// "current_holders",
|
||||||
"current_holders.orgRoot",
|
// "current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
// "current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
// "current_holders.orgChild2",
|
||||||
"current_holders.orgChild3",
|
// "current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
// "current_holders.orgChild4",
|
||||||
],
|
// ],
|
||||||
|
relations:{
|
||||||
|
posType: true,
|
||||||
|
posLevel: true,
|
||||||
|
current_holders: {
|
||||||
|
orgRevision: true,
|
||||||
|
orgRoot: true,
|
||||||
|
orgChild1: true,
|
||||||
|
orgChild2: true,
|
||||||
|
orgChild3: true,
|
||||||
|
orgChild4: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||||
|
|
@ -4292,7 +4304,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
@Get("keycloak")
|
@Get("keycloak")
|
||||||
async GetProfileWithKeycloak() {
|
async GetProfileWithKeycloak() {
|
||||||
const profile = await this.profileRepo.find({
|
const profile = await this.profileRepo.find({
|
||||||
where: { keycloak: Not(IsNull()) || Not("") },
|
where: { keycloak: Not(IsNull()) },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
|
|
@ -4302,111 +4314,194 @@ export class OrganizationDotnetController extends Controller {
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
"profileSalary",
|
// "profileSalary",
|
||||||
],
|
],
|
||||||
order: {
|
// order: {
|
||||||
profileSalary: {
|
// profileSalary: {
|
||||||
order: "DESC",
|
// order: "DESC",
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
});
|
});
|
||||||
|
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const profile_ = await Promise.all(
|
// const profile_ = await Promise.all(
|
||||||
profile.map((item: Profile) => {
|
// profile.map((item: Profile) => {
|
||||||
const rootName =
|
// const rootName =
|
||||||
item.current_holders.length == 0
|
// item.current_holders.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
||||||
?.orgRootName;
|
// ?.orgRootName;
|
||||||
const shortName =
|
// const shortName =
|
||||||
item.current_holders.length == 0
|
// item.current_holders.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||||
null
|
// null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
?.orgChild3 != null
|
// ?.orgChild3 != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
?.orgChild2 != null
|
// ?.orgChild2 != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
?.orgChild1 != null
|
// ?.orgChild1 != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||||
null &&
|
// null &&
|
||||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
?.orgRoot != null
|
// ?.orgRoot != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: null;
|
// : null;
|
||||||
|
|
||||||
return {
|
// return {
|
||||||
oc: rootName,
|
// oc: rootName,
|
||||||
id: item.id,
|
// id: item.id,
|
||||||
createdAt: item.createdAt,
|
// createdAt: item.createdAt,
|
||||||
createdUserId: item.createdUserId,
|
// createdUserId: item.createdUserId,
|
||||||
lastUpdatedAt: item.lastUpdatedAt,
|
// lastUpdatedAt: item.lastUpdatedAt,
|
||||||
lastUpdateUserId: item.lastUpdateUserId,
|
// lastUpdateUserId: item.lastUpdateUserId,
|
||||||
createdFullName: item.createdFullName,
|
// createdFullName: item.createdFullName,
|
||||||
lastUpdateFullName: item.lastUpdateFullName,
|
// lastUpdateFullName: item.lastUpdateFullName,
|
||||||
avatar: item.avatar,
|
// avatar: item.avatar,
|
||||||
avatarName: item.avatarName,
|
// avatarName: item.avatarName,
|
||||||
rank: item.rank,
|
// rank: item.rank,
|
||||||
prefix: item.prefix,
|
// prefix: item.prefix,
|
||||||
firstName: item.firstName,
|
// firstName: item.firstName,
|
||||||
lastName: item.lastName,
|
// lastName: item.lastName,
|
||||||
citizenId: item.citizenId,
|
// citizenId: item.citizenId,
|
||||||
position: item.position,
|
// position: item.position,
|
||||||
posLevelId: item.posLevelId,
|
// posLevelId: item.posLevelId,
|
||||||
posTypeId: item.posTypeId,
|
// posTypeId: item.posTypeId,
|
||||||
email: item.email,
|
// email: item.email,
|
||||||
phone: item.phone,
|
// phone: item.phone,
|
||||||
keycloak: item.keycloak,
|
// keycloak: item.keycloak,
|
||||||
isProbation: item.isProbation,
|
// isProbation: item.isProbation,
|
||||||
isLeave: item.isLeave,
|
// isLeave: item.isLeave,
|
||||||
leaveReason: item.leaveReason,
|
// leaveReason: item.leaveReason,
|
||||||
dateLeave: item.dateLeave,
|
// dateLeave: item.dateLeave,
|
||||||
dateRetire: item.dateRetire,
|
// dateRetire: item.dateRetire,
|
||||||
dateAppoint: item.dateAppoint,
|
// dateAppoint: item.dateAppoint,
|
||||||
dateRetireLaw: item.dateRetireLaw,
|
// dateRetireLaw: item.dateRetireLaw,
|
||||||
dateStart: item.dateStart,
|
// dateStart: item.dateStart,
|
||||||
govAgeAbsent: item.govAgeAbsent,
|
// govAgeAbsent: item.govAgeAbsent,
|
||||||
govAgePlus: item.govAgePlus,
|
// govAgePlus: item.govAgePlus,
|
||||||
birthDate: item.birthDate ?? new Date(),
|
// birthDate: item.birthDate ?? new Date(),
|
||||||
reasonSameDate: item.reasonSameDate,
|
// reasonSameDate: item.reasonSameDate,
|
||||||
ethnicity: item.ethnicity,
|
// ethnicity: item.ethnicity,
|
||||||
telephoneNumber: item.phone,
|
// telephoneNumber: item.phone,
|
||||||
nationality: item.nationality,
|
// nationality: item.nationality,
|
||||||
gender: item.gender,
|
// gender: item.gender,
|
||||||
relationship: item.relationship,
|
// relationship: item.relationship,
|
||||||
religion: item.religion,
|
// religion: item.religion,
|
||||||
bloodGroup: item.bloodGroup,
|
// bloodGroup: item.bloodGroup,
|
||||||
registrationAddress: item.registrationAddress,
|
// registrationAddress: item.registrationAddress,
|
||||||
registrationProvinceId: item.registrationProvinceId,
|
// registrationProvinceId: item.registrationProvinceId,
|
||||||
registrationDistrictId: item.registrationDistrictId,
|
// registrationDistrictId: item.registrationDistrictId,
|
||||||
registrationSubDistrictId: item.registrationSubDistrictId,
|
// registrationSubDistrictId: item.registrationSubDistrictId,
|
||||||
registrationZipCode: item.registrationZipCode,
|
// registrationZipCode: item.registrationZipCode,
|
||||||
currentAddress: item.currentAddress,
|
// currentAddress: item.currentAddress,
|
||||||
currentProvinceId: item.currentProvinceId,
|
// currentProvinceId: item.currentProvinceId,
|
||||||
currentDistrictId: item.currentDistrictId,
|
// currentDistrictId: item.currentDistrictId,
|
||||||
currentSubDistrictId: item.currentSubDistrictId,
|
// currentSubDistrictId: item.currentSubDistrictId,
|
||||||
currentZipCode: item.currentZipCode,
|
// currentZipCode: item.currentZipCode,
|
||||||
dutyTimeId: item.dutyTimeId,
|
// dutyTimeId: item.dutyTimeId,
|
||||||
dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
// dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
||||||
positionLevel: item.posLevel?.posLevelName ?? null,
|
// positionLevel: item.posLevel?.posLevelName ?? null,
|
||||||
positionType: item.posType?.posTypeName ?? null,
|
// positionType: item.posType?.posTypeName ?? null,
|
||||||
posNo: shortName,
|
// posNo: shortName,
|
||||||
};
|
// };
|
||||||
}),
|
// }),
|
||||||
);
|
// );
|
||||||
|
const profile_ = profile.map((item: Profile) => {
|
||||||
|
const holder = item.current_holders?.find(
|
||||||
|
(x) => x.orgRevisionId === findRevision?.id,
|
||||||
|
);
|
||||||
|
|
||||||
|
const rootName = holder?.orgRoot?.orgRootName ?? null;
|
||||||
|
|
||||||
|
let shortName: string | null = null;
|
||||||
|
|
||||||
|
if (holder) {
|
||||||
|
const posNo = holder.posMasterNo;
|
||||||
|
|
||||||
|
if (holder.orgChild4) {
|
||||||
|
shortName = `${holder.orgChild4.orgChild4ShortName} ${posNo}`;
|
||||||
|
} else if (holder.orgChild3) {
|
||||||
|
shortName = `${holder.orgChild3.orgChild3ShortName} ${posNo}`;
|
||||||
|
} else if (holder.orgChild2) {
|
||||||
|
shortName = `${holder.orgChild2.orgChild2ShortName} ${posNo}`;
|
||||||
|
} else if (holder.orgChild1) {
|
||||||
|
shortName = `${holder.orgChild1.orgChild1ShortName} ${posNo}`;
|
||||||
|
} else if (holder.orgRoot) {
|
||||||
|
shortName = `${holder.orgRoot.orgRootShortName} ${posNo}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
oc: rootName,
|
||||||
|
id: item.id,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
createdUserId: item.createdUserId,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateUserId: item.lastUpdateUserId,
|
||||||
|
createdFullName: item.createdFullName,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
avatar: item.avatar,
|
||||||
|
avatarName: item.avatarName,
|
||||||
|
rank: item.rank,
|
||||||
|
prefix: item.prefix,
|
||||||
|
firstName: item.firstName,
|
||||||
|
lastName: item.lastName,
|
||||||
|
citizenId: item.citizenId,
|
||||||
|
position: item.position,
|
||||||
|
posLevelId: item.posLevelId,
|
||||||
|
posTypeId: item.posTypeId,
|
||||||
|
email: item.email,
|
||||||
|
phone: item.phone,
|
||||||
|
keycloak: item.keycloak,
|
||||||
|
isProbation: item.isProbation,
|
||||||
|
isLeave: item.isLeave,
|
||||||
|
leaveReason: item.leaveReason,
|
||||||
|
dateLeave: item.dateLeave,
|
||||||
|
dateRetire: item.dateRetire,
|
||||||
|
dateAppoint: item.dateAppoint,
|
||||||
|
dateRetireLaw: item.dateRetireLaw,
|
||||||
|
dateStart: item.dateStart,
|
||||||
|
govAgeAbsent: item.govAgeAbsent,
|
||||||
|
govAgePlus: item.govAgePlus,
|
||||||
|
birthDate: item.birthDate ?? new Date(),
|
||||||
|
reasonSameDate: item.reasonSameDate,
|
||||||
|
ethnicity: item.ethnicity,
|
||||||
|
telephoneNumber: item.phone,
|
||||||
|
nationality: item.nationality,
|
||||||
|
gender: item.gender,
|
||||||
|
relationship: item.relationship,
|
||||||
|
religion: item.religion,
|
||||||
|
bloodGroup: item.bloodGroup,
|
||||||
|
registrationAddress: item.registrationAddress,
|
||||||
|
registrationProvinceId: item.registrationProvinceId,
|
||||||
|
registrationDistrictId: item.registrationDistrictId,
|
||||||
|
registrationSubDistrictId: item.registrationSubDistrictId,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentAddress: item.currentAddress,
|
||||||
|
currentProvinceId: item.currentProvinceId,
|
||||||
|
currentDistrictId: item.currentDistrictId,
|
||||||
|
currentSubDistrictId: item.currentSubDistrictId,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
dutyTimeId: item.dutyTimeId,
|
||||||
|
dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
||||||
|
positionLevel: item.posLevel?.posLevelName ?? null,
|
||||||
|
positionType: item.posType?.posTypeName ?? null,
|
||||||
|
posNo: shortName,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return new HttpSuccess(profile_);
|
return new HttpSuccess(profile_);
|
||||||
}
|
}
|
||||||
|
|
@ -4430,13 +4525,13 @@ export class OrganizationDotnetController extends Controller {
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
"profileSalary",
|
// "profileSalary",
|
||||||
],
|
],
|
||||||
order: {
|
// order: {
|
||||||
profileSalary: {
|
// profileSalary: {
|
||||||
order: "DESC",
|
// order: "DESC",
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
});
|
});
|
||||||
|
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
|
@ -7114,7 +7209,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
if (type.trim().toLocaleUpperCase() == "OFFICER") {
|
if (type.trim().toLocaleUpperCase() == "OFFICER") {
|
||||||
profile = await this.profileRepo.find({
|
profile = await this.profileRepo.find({
|
||||||
relations: [
|
relations: [
|
||||||
"profileSalary",
|
// "profileSalary",
|
||||||
"profileInsignias",
|
"profileInsignias",
|
||||||
"profileDisciplines",
|
"profileDisciplines",
|
||||||
"profileAssessments",
|
"profileAssessments",
|
||||||
|
|
@ -7124,7 +7219,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
} else {
|
} else {
|
||||||
profile = await this.profileEmpRepo.find({
|
profile = await this.profileEmpRepo.find({
|
||||||
relations: [
|
relations: [
|
||||||
"profileSalary",
|
// "profileSalary",
|
||||||
"profileInsignias",
|
"profileInsignias",
|
||||||
"profileDisciplines",
|
"profileDisciplines",
|
||||||
"profileAssessments",
|
"profileAssessments",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue