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,
reason: item.reason ? item.reason : null,
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("/"),
posType: item.positions.map((x) => x.posType.posTypeName).join("/"),
fullname:

View file

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