no message

This commit is contained in:
Kittapath 2024-07-08 20:37:55 +07:00
parent f1e8a6f8de
commit 1dceb4a114
2 changed files with 90 additions and 48 deletions

View file

@ -1601,7 +1601,10 @@ export class PositionController extends Controller {
posMasterNoSuffix: item.posMasterNoSuffix ? item.posMasterNoSuffix : null, posMasterNoSuffix: item.posMasterNoSuffix ? item.posMasterNoSuffix : null,
reason: item.reason ? item.reason : null, reason: item.reason ? item.reason : null,
position: item.positions.map((x) => x.positionName).join("/"), position: item.positions.map((x) => x.positionName).join("/"),
posExecutive: item.positions.map((x) => x.posExecutive.posExecutiveName).join("/"), posExecutive: item.positions
.filter((x) => x.posExecutive != null)
.map((x) => x.posExecutive?.posExecutiveName ?? null)
.join("/"),
posLevel: item.positions.map((x) => x.posLevel.posLevelName).join("/"), posLevel: item.positions.map((x) => x.posLevel.posLevelName).join("/"),
posType: item.positions.map((x) => x.posType.posTypeName).join("/"), posType: item.positions.map((x) => x.posType.posTypeName).join("/"),
fullname: fullname:

View file

@ -250,11 +250,7 @@ export class ProfileController extends Controller {
// "telephoneNumber", // "telephoneNumber",
// "avatar", // "avatar",
// ], // ],
relations: [ relations: ["currentSubDistrict", "currentDistrict", "currentProvince"],
"currentSubDistrict",
"currentDistrict",
"currentProvince",
],
where: { id: id }, where: { id: id },
}); });
const profileOc = await this.profileRepo.findOne({ const profileOc = await this.profileRepo.findOne({
@ -363,11 +359,7 @@ export class ProfileController extends Controller {
Area: "", Area: "",
Province: "", Province: "",
Telephone: Telephone:
profiles.telephoneNumber != null profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
? Extension.ToThaiNumber(
profiles.telephoneNumber
)
: "",
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null, CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "", CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
CoupleFullName: CoupleFullName:
@ -403,9 +395,7 @@ export class ProfileController extends Controller {
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
: "", : "",
CurrentAddress: CurrentAddress:
profiles.currentAddress != null profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
? Extension.ToThaiNumber(profiles.currentAddress)
: "",
CurrentSubDistrict: CurrentSubDistrict:
profiles.currentSubDistrict != null profiles.currentSubDistrict != null
? Extension.ToThaiNumber(profiles.currentSubDistrict.name) ? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
@ -534,24 +524,12 @@ export class ProfileController extends Controller {
InsigniaName: item.insignia.name, InsigniaName: item.insignia.name,
InsigniaShortName: item.insignia.shortName, InsigniaShortName: item.insignia.shortName,
InsigniaTypeName: item.insignia.insigniaType.name, InsigniaTypeName: item.insignia.insigniaType.name,
No: item.no No: item.no ? Extension.ToThaiNumber(item.no) : "",
? Extension.ToThaiNumber(item.no) Issue: item.issue ? item.issue : "",
: "", VolumeNo: item.volumeNo ? Extension.ToThaiNumber(item.volumeNo) : "",
Issue: item.issue Volume: item.volume ? Extension.ToThaiNumber(item.volume) : "",
? item.issue Section: item.section ? Extension.ToThaiNumber(item.section) : "",
: "", Page: item.page ? Extension.ToThaiNumber(item.page) : "",
VolumeNo: item.volumeNo
? Extension.ToThaiNumber(item.volumeNo)
: "",
Volume: item.volume
? Extension.ToThaiNumber(item.volume)
: "",
Section: item.section
? Extension.ToThaiNumber(item.section)
: "",
Page: item.page
? Extension.ToThaiNumber(item.page)
: "",
RefCommandDate: item.refCommandDate RefCommandDate: item.refCommandDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
: "", : "",
@ -567,9 +545,7 @@ export class ProfileController extends Controller {
DateLeaveStart: item.dateLeaveStart DateLeaveStart: item.dateLeaveStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart))
: "", : "",
LeaveDays: item.leaveDays LeaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "",
? Extension.ToThaiNumber(item.leaveDays.toString())
: "",
})); }));
return new HttpSuccess({ return new HttpSuccess({
@ -580,7 +556,7 @@ export class ProfileController extends Controller {
Education, Education,
Salary, Salary,
Insignia, Insignia,
Leave Leave,
}); });
} }
/** /**
@ -1168,6 +1144,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1264,6 +1245,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1356,6 +1342,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1447,6 +1438,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1552,6 +1548,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1643,6 +1644,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1734,6 +1740,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1825,6 +1836,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -1916,6 +1932,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -2007,6 +2028,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -2098,6 +2124,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -2189,6 +2220,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: ["profileSalary"], relations: ["profileSalary"],
where: { id: body.profileId }, where: { id: body.profileId },
order: {
profileSalary: {
order: "DESC",
},
},
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
@ -3145,22 +3181,25 @@ export class ProfileController extends Controller {
profile.current_holders.length == 0 profile.current_holders.length == 0
? null ? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 != profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
null ?.orgChild4 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 != profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
null ?.orgChild3 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 != null &&
null profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild1 != null ?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgRoot != null ?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`