เผยแพร่ข้อมูลโครงสร้าง

This commit is contained in:
Kittapath 2024-06-30 20:50:12 +07:00
parent 4f8bc677a0
commit 149be41373
3 changed files with 118 additions and 19 deletions

View file

@ -178,6 +178,20 @@ export class ProfileController extends Controller {
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
const educations = await this.educationRepository.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileId: id },
order: { lastUpdatedAt: "DESC" },
});
const Education = educations.map((item) => ({
Institute: item.institute,
Date:
item.startDate && item.endDate
? `${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.endDate))}`
: "",
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "",
}));
const mapData = {
Id: profile.id,
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
@ -199,7 +213,7 @@ export class ProfileController extends Controller {
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
: "",
Education: profile.profileEducations,
Education: Education,
AppointText:
profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
@ -498,7 +512,7 @@ export class ProfileController extends Controller {
@Get("placement/{id}")
async getProfilePlacement(@Request() request: RequestWithUser, @Path() id: string) {
const profile = await this.profileRepo.findOne({
where: { keycloak: request.user.sub },
where: { id: id },
});
const posMaster = await this.posMasterRepo.findOne({
@ -4989,7 +5003,14 @@ export class ProfileController extends Controller {
*/
@Get("salarym/zxczxcsa")
async zxczxczxczxczxc() {
const profile = await this.profileRepo.find({ relations: ["current_holders", "next_holders"] });
const [profile, total] = await this.profileRepo
.createQueryBuilder("profile")
.leftJoinAndSelect("profile.current_holders", "current_holders")
.leftJoinAndSelect("profile.next_holders", "next_holders")
.skip(1)
.take(50)
.getManyAndCount();
const profiles = await Promise.all(
profile.map(async (_data) => {
if (_data.current_holders.length == 0 && _data.next_holders.length == 0) {