Merge branch 'develop' into adiDev
This commit is contained in:
commit
92b1803db0
8 changed files with 255 additions and 89 deletions
|
|
@ -106,7 +106,15 @@ export class OrganizationDotnetController extends Controller {
|
||||||
const queryBuilder = profileRepository
|
const queryBuilder = profileRepository
|
||||||
.createQueryBuilder("profile")
|
.createQueryBuilder("profile")
|
||||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("profile.posType", "posType");
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.leftJoinAndSelect("profile.profileSalarys", "profileSalarys")
|
||||||
|
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
|
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
|
.orderBy("profileSalarys.order", "DESC");
|
||||||
|
|
||||||
if (body.citizenId || body.firstName || body.lastName) {
|
if (body.citizenId || body.firstName || body.lastName) {
|
||||||
queryBuilder.where(
|
queryBuilder.where(
|
||||||
|
|
@ -123,8 +131,102 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const profileEmp = await queryBuilder.getMany();
|
const profileEmp = await queryBuilder.getMany();
|
||||||
return new HttpSuccess(profileEmp);
|
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
const profileEmp_ = await Promise.all(
|
||||||
|
profileEmp.map((item: ProfileEmployee) => {
|
||||||
|
const rootName =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot?.orgRootName;
|
||||||
|
const shortName =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||||
|
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) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.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) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.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) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.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) !=
|
||||||
|
null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgRoot != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: null;
|
||||||
|
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,
|
||||||
|
reasonSameDate: item.reasonSameDate,
|
||||||
|
ethnicity: item.ethnicity,
|
||||||
|
telephoneNumber: item.telephoneNumber,
|
||||||
|
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,
|
||||||
|
posLevel: item.posLevel,
|
||||||
|
posType: item.posType,
|
||||||
|
posNo: shortName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return new HttpSuccess(profileEmp_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -799,8 +901,122 @@ export class OrganizationDotnetController extends Controller {
|
||||||
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()) || Not("") },
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
"profileSalary"
|
||||||
|
],
|
||||||
|
order: {
|
||||||
|
profileSalary: {
|
||||||
|
order: "DESC",
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new HttpSuccess(profile);
|
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
const profile_ = await Promise.all(
|
||||||
|
profile.map((item: Profile) => {
|
||||||
|
const rootName =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot?.orgRootName;
|
||||||
|
const shortName =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||||
|
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) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.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) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.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) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.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) !=
|
||||||
|
null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgRoot != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: null;
|
||||||
|
|
||||||
|
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,
|
||||||
|
reasonSameDate: item.reasonSameDate,
|
||||||
|
ethnicity: item.ethnicity,
|
||||||
|
telephoneNumber: item.telephoneNumber,
|
||||||
|
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.profileSalary.length > 0
|
||||||
|
? item.profileSalary[0].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo: shortName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
return new HttpSuccess(profile_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2563,6 +2563,9 @@ export class ProfileController extends Controller {
|
||||||
posType: true,
|
posType: true,
|
||||||
},
|
},
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
|
order: {
|
||||||
|
createdAt: "ASC",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
|
||||||
|
|
@ -665,17 +665,6 @@ export class ProfileEmployeeController extends Controller {
|
||||||
const record = await this.profileRepo.findOneBy({ id });
|
const record = await this.profileRepo.findOneBy({ id });
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
await this.profileHistoryRepo.save(
|
|
||||||
Object.assign(new ProfileEmployeeHistory(), {
|
|
||||||
...record,
|
|
||||||
lastUpdateUserId: request.user.sub,
|
|
||||||
lastUpdateFullName: request.user.name,
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
profileEmployeeId: id,
|
|
||||||
id: undefined,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
||||||
body.employeeClass = "PERM";
|
body.employeeClass = "PERM";
|
||||||
}
|
}
|
||||||
|
|
@ -691,6 +680,16 @@ export class ProfileEmployeeController extends Controller {
|
||||||
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
||||||
record.citizenId = Extension.CheckCitizen(record.citizenId);
|
record.citizenId = Extension.CheckCitizen(record.citizenId);
|
||||||
record.employeeClass = record.employeeClass.toLocaleUpperCase();
|
record.employeeClass = record.employeeClass.toLocaleUpperCase();
|
||||||
|
await this.profileHistoryRepo.save(
|
||||||
|
Object.assign(new ProfileEmployeeHistory(), {
|
||||||
|
...record,
|
||||||
|
lastUpdateUserId: request.user.sub,
|
||||||
|
lastUpdateFullName: request.user.name,
|
||||||
|
lastUpdatedAt: new Date(),
|
||||||
|
profileEmployeeId: id,
|
||||||
|
id: undefined,
|
||||||
|
}),
|
||||||
|
);
|
||||||
await this.profileRepo.save(record);
|
await this.profileRepo.save(record);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -1395,11 +1394,11 @@ export class ProfileEmployeeController extends Controller {
|
||||||
relations: {
|
relations: {
|
||||||
posLevel: true,
|
posLevel: true,
|
||||||
posType: true,
|
posType: true,
|
||||||
// gender: true,
|
|
||||||
// relationship: true,
|
|
||||||
// bloodGroup: true,
|
|
||||||
},
|
},
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
|
order: {
|
||||||
|
createdAt: "ASC",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -3037,36 +3036,13 @@ export class ProfileEmployeeController extends Controller {
|
||||||
@Get("information/history/{profileEmployeeId}")
|
@Get("information/history/{profileEmployeeId}")
|
||||||
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||||
const profileInformation = await this.profileRepo.find({
|
const profileInformation = await this.informationHistoryRepository.find({
|
||||||
relations: {
|
where: { profileEmployeeId: profileEmployeeId },
|
||||||
information_histories: true,
|
order: {
|
||||||
|
createdAt: "ASC",
|
||||||
},
|
},
|
||||||
where: { id: profileEmployeeId },
|
|
||||||
});
|
});
|
||||||
if (!profileInformation) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
return new HttpSuccess(profileInformation);
|
||||||
|
|
||||||
const mapData = profileInformation
|
|
||||||
.flatMap((profile) => profile.information_histories)
|
|
||||||
.map((history) => ({
|
|
||||||
id: history.id,
|
|
||||||
positionEmployeeGroupId: history.positionEmployeeGroupId,
|
|
||||||
positionEmployeeLineId: history.positionEmployeeLineId,
|
|
||||||
positionEmployeePositionId: history.positionEmployeePositionId,
|
|
||||||
employeeOc: history.employeeOc,
|
|
||||||
employeeTypeIndividual: history.employeeTypeIndividual,
|
|
||||||
employeeWage: history.employeeWage,
|
|
||||||
employeeMoneyIncrease: history.employeeMoneyIncrease,
|
|
||||||
employeeMoneyAllowance: history.employeeMoneyAllowance,
|
|
||||||
employeeMoneyEmployee: history.employeeMoneyEmployee,
|
|
||||||
employeeMoneyEmployer: history.employeeMoneyEmployer,
|
|
||||||
createdAt: history.createdAt,
|
|
||||||
createdUserId: history.createdUserId,
|
|
||||||
createdFullName: history.createdFullName,
|
|
||||||
lastUpdatedAt: history.lastUpdatedAt,
|
|
||||||
lastUpdateUserId: history.lastUpdateUserId,
|
|
||||||
lastUpdateFullName: history.lastUpdateFullName,
|
|
||||||
}));
|
|
||||||
return new HttpSuccess(mapData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -662,14 +662,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
const record = await this.profileRepo.findOneBy({ id });
|
const record = await this.profileRepo.findOneBy({ id });
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
await this.profileHistoryRepo.save(
|
|
||||||
Object.assign(new ProfileEmployeeHistory(), {
|
|
||||||
...record,
|
|
||||||
profileEmployeeId: id,
|
|
||||||
id: undefined,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
if (body.employeeClass == null || body.employeeClass == undefined || body.employeeClass == "") {
|
||||||
body.employeeClass = "PERM";
|
body.employeeClass = "PERM";
|
||||||
}
|
}
|
||||||
|
|
@ -685,6 +677,13 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
||||||
record.citizenId = Extension.CheckCitizen(record.citizenId);
|
record.citizenId = Extension.CheckCitizen(record.citizenId);
|
||||||
record.employeeClass = record.employeeClass.toLocaleUpperCase();
|
record.employeeClass = record.employeeClass.toLocaleUpperCase();
|
||||||
|
await this.profileHistoryRepo.save(
|
||||||
|
Object.assign(new ProfileEmployeeHistory(), {
|
||||||
|
...record,
|
||||||
|
profileEmployeeId: id,
|
||||||
|
id: undefined,
|
||||||
|
}),
|
||||||
|
);
|
||||||
await this.profileRepo.save(record);
|
await this.profileRepo.save(record);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -1333,11 +1332,11 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
relations: {
|
relations: {
|
||||||
posLevel: true,
|
posLevel: true,
|
||||||
posType: true,
|
posType: true,
|
||||||
// gender: true,
|
|
||||||
// relationship: true,
|
|
||||||
// bloodGroup: true,
|
|
||||||
},
|
},
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
|
order: {
|
||||||
|
createdAt: "ASC",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -2973,36 +2972,13 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
@Get("information/history/{profileEmployeeId}")
|
@Get("information/history/{profileEmployeeId}")
|
||||||
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||||
const profileInformation = await this.profileRepo.find({
|
const profileInformation = await this.informationHistoryRepository.find({
|
||||||
relations: {
|
where: { profileEmployeeId: profileEmployeeId },
|
||||||
information_histories: true,
|
order: {
|
||||||
|
createdAt: "ASC",
|
||||||
},
|
},
|
||||||
where: { id: profileEmployeeId },
|
|
||||||
});
|
});
|
||||||
if (!profileInformation) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
return new HttpSuccess(profileInformation);
|
||||||
|
|
||||||
const mapData = profileInformation
|
|
||||||
.flatMap((profile) => profile.information_histories)
|
|
||||||
.map((history) => ({
|
|
||||||
id: history.id,
|
|
||||||
positionEmployeeGroupId: history.positionEmployeeGroupId,
|
|
||||||
positionEmployeeLineId: history.positionEmployeeLineId,
|
|
||||||
positionEmployeePositionId: history.positionEmployeePositionId,
|
|
||||||
employeeOc: history.employeeOc,
|
|
||||||
employeeTypeIndividual: history.employeeTypeIndividual,
|
|
||||||
employeeWage: history.employeeWage,
|
|
||||||
employeeMoneyIncrease: history.employeeMoneyIncrease,
|
|
||||||
employeeMoneyAllowance: history.employeeMoneyAllowance,
|
|
||||||
employeeMoneyEmployee: history.employeeMoneyEmployee,
|
|
||||||
employeeMoneyEmployer: history.employeeMoneyEmployer,
|
|
||||||
createdAt: history.createdAt,
|
|
||||||
createdUserId: history.createdUserId,
|
|
||||||
createdFullName: history.createdFullName,
|
|
||||||
lastUpdatedAt: history.lastUpdatedAt,
|
|
||||||
lastUpdateUserId: history.lastUpdateUserId,
|
|
||||||
lastUpdateFullName: history.lastUpdateFullName,
|
|
||||||
}));
|
|
||||||
return new HttpSuccess(mapData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -689,7 +689,6 @@ export class ReportController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(data);
|
|
||||||
return new HttpSuccess({ template: "report1", reportName: "report1", data: { data } });
|
return new HttpSuccess({ template: "report1", reportName: "report1", data: { data } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,5 @@ export const AppDataSource = new DataSource({
|
||||||
: ["dist/migration/**/*{.ts,.js}"],
|
: ["dist/migration/**/*{.ts,.js}"],
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
});
|
});
|
||||||
// console.log(AppDataSource);
|
|
||||||
|
|
||||||
// export default database;
|
// export default database;
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,6 @@ class Extension {
|
||||||
});
|
});
|
||||||
const delAsync = promisify(redisClient.del).bind(redisClient);
|
const delAsync = promisify(redisClient.del).bind(redisClient);
|
||||||
const deleteKey = delAsync(type + id);
|
const deleteKey = delAsync(type + id);
|
||||||
console.log(`Deleted ${deleteKey} keys.`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ const KC_REALM = process.env.KC_REALM;
|
||||||
const KC_CLIENT_ID = process.env.KC_SERVICE_ACCOUNT_CLIENT_ID;
|
const KC_CLIENT_ID = process.env.KC_SERVICE_ACCOUNT_CLIENT_ID;
|
||||||
const KC_SECRET = process.env.KC_SERVICE_ACCOUNT_SECRET;
|
const KC_SECRET = process.env.KC_SERVICE_ACCOUNT_SECRET;
|
||||||
|
|
||||||
console.log(process.env.KC_URL);
|
|
||||||
|
|
||||||
let token: string | null = null;
|
let token: string | null = null;
|
||||||
let decoded: DecodedJwt | null = null;
|
let decoded: DecodedJwt | null = null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue