แก้ไข profile เพิ่มเติม
This commit is contained in:
parent
857b0624f4
commit
d96a6319b6
1 changed files with 71 additions and 73 deletions
|
|
@ -301,73 +301,71 @@ export class ProfileController extends Controller {
|
||||||
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
|
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
|
||||||
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
||||||
|
|
||||||
const Profile = [
|
const Profile = {
|
||||||
{
|
CitizenId:
|
||||||
CitizenId:
|
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
||||||
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
Prefix: profiles?.prefix != null ? profiles.prefix : "",
|
||||||
Prefix: profiles?.prefix != null ? profiles.prefix : "",
|
FirstName: profiles?.firstName != null ? profiles.firstName : "",
|
||||||
FirstName: profiles?.firstName != null ? profiles.firstName : "",
|
LastName: profiles?.lastName != null ? profiles.lastName : "",
|
||||||
LastName: profiles?.lastName != null ? profiles.lastName : "",
|
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
BirthDay: profiles?.birthDate
|
||||||
BirthDay: profiles?.birthDate
|
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
|
||||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
|
: null,
|
||||||
|
BirthDayText:
|
||||||
|
profiles.birthDate != null
|
||||||
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||||
|
: "",
|
||||||
|
BirthMonth: profiles?.birthDate
|
||||||
|
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
|
||||||
|
: null, // Months are zero-based
|
||||||
|
BirthYear: profiles?.birthDate
|
||||||
|
? Extension.ToThaiNumber(new Date(profiles.birthDate).getFullYear().toString())
|
||||||
|
: null,
|
||||||
|
BirthYearText:
|
||||||
|
profiles.birthDate != null
|
||||||
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||||
|
: "",
|
||||||
|
Address: "",
|
||||||
|
District: "",
|
||||||
|
Area: "",
|
||||||
|
Province: "",
|
||||||
|
Telephone: profiles?.telephoneNumber ?? null,
|
||||||
|
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||||
|
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
|
||||||
|
CoupleFullName:
|
||||||
|
profileFamilyCouple?.couplePrefix ||
|
||||||
|
profileFamilyCouple?.coupleFirstName ||
|
||||||
|
profileFamilyCouple?.coupleLastNameOld
|
||||||
|
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
||||||
: null,
|
: null,
|
||||||
BirthDayText:
|
FatherPrefix: profileFamilyFather?.fatherPrefix ?? "",
|
||||||
profiles.birthDate != null
|
FatherFullName:
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
profileFamilyFather?.fatherPrefix ||
|
||||||
: "",
|
profileFamilyFather?.fatherFirstName ||
|
||||||
BirthMonth: profiles?.birthDate
|
profileFamilyFather?.fatherLastName
|
||||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
|
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||||
: null, // Months are zero-based
|
|
||||||
BirthYear: profiles?.birthDate
|
|
||||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getFullYear().toString())
|
|
||||||
: null,
|
: null,
|
||||||
BirthYearText:
|
MotherPrefix: profileFamilyMother?.motherPrefix ?? "",
|
||||||
profiles.birthDate != null
|
MotherFullName:
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
profileFamilyMother?.motherPrefix ||
|
||||||
: "",
|
profileFamilyMother?.motherFirstName ||
|
||||||
Address: "",
|
profileFamilyMother?.motherLastName
|
||||||
District: "",
|
? `${profileFamilyMother?.motherPrefix ?? ""} ${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
||||||
Area: "",
|
|
||||||
Province: "",
|
|
||||||
Telephone: profiles?.telephoneNumber ?? null,
|
|
||||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
|
||||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
|
|
||||||
CoupleFullName:
|
|
||||||
profileFamilyCouple?.couplePrefix ||
|
|
||||||
profileFamilyCouple?.coupleFirstName ||
|
|
||||||
profileFamilyCouple?.coupleLastNameOld
|
|
||||||
? `${profileFamilyCouple?.couplePrefix ?? ""} ${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastNameOld ?? ""}`.trim()
|
|
||||||
: null,
|
|
||||||
FatherPrefix: profileFamilyFather?.fatherPrefix ?? "",
|
|
||||||
FatherFullName:
|
|
||||||
profileFamilyFather?.fatherPrefix ||
|
|
||||||
profileFamilyFather?.fatherFirstName ||
|
|
||||||
profileFamilyFather?.fatherLastName
|
|
||||||
? `${profileFamilyFather?.fatherPrefix ?? ""} ${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
|
||||||
: null,
|
|
||||||
MotherPrefix: profileFamilyMother?.motherPrefix ?? "",
|
|
||||||
MotherFullName:
|
|
||||||
profileFamilyMother?.motherPrefix ||
|
|
||||||
profileFamilyMother?.motherFirstName ||
|
|
||||||
profileFamilyMother?.motherLastName
|
|
||||||
? `${profileFamilyMother?.motherPrefix ?? ""} ${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
|
||||||
: null,
|
|
||||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
|
||||||
Division: "",
|
|
||||||
Institute: "",
|
|
||||||
StartDate: profiles?.dateStart,
|
|
||||||
AppointDate: profiles?.dateAppoint,
|
|
||||||
BirthDate: profiles?.birthDate
|
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
|
||||||
: null,
|
: null,
|
||||||
RetireDate:
|
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
profiles.dateRetireLaw != null
|
Division: "",
|
||||||
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
|
Institute: "",
|
||||||
: "",
|
StartDate: profiles?.dateStart,
|
||||||
// AvatarId: profiles?.avatar ?? null,
|
AppointDate: profiles?.dateAppoint ?? "",
|
||||||
},
|
BirthDate: profiles?.birthDate
|
||||||
];
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||||
|
: null,
|
||||||
|
RetireDate:
|
||||||
|
profiles.dateRetireLaw != null
|
||||||
|
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
|
||||||
|
: "",
|
||||||
|
// AvatarId: profiles?.avatar ?? null,
|
||||||
|
};
|
||||||
|
|
||||||
const certs = await this.certificateRepository.find({
|
const certs = await this.certificateRepository.find({
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
|
|
@ -384,12 +382,12 @@ export class ProfileController extends Controller {
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
});
|
});
|
||||||
const Training = trainings.map((item) => ({
|
const Training = trainings.map((item) => ({
|
||||||
Institute: item.department ?? null,
|
Institute: item.department ?? "",
|
||||||
Start: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()) ?? null,
|
Start: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()) ?? "",
|
||||||
End: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()) ?? null,
|
End: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()) ?? "",
|
||||||
Level: "",
|
Level: "",
|
||||||
Degree: "",
|
Degree: "",
|
||||||
Field: item.place ?? null,
|
Field: item.place ?? "",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const disciplines = await this.disciplineRepository.find({
|
const disciplines = await this.disciplineRepository.find({
|
||||||
|
|
@ -408,12 +406,12 @@ export class ProfileController extends Controller {
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
});
|
});
|
||||||
const Education = educations.map((item) => ({
|
const Education = educations.map((item) => ({
|
||||||
Institute: item.institute ?? null,
|
Institute: item.institute ?? "",
|
||||||
Start: Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()) ?? null,
|
Start: Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()) ?? null,
|
||||||
End: Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()) ?? null,
|
End: Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()) ?? null,
|
||||||
Level: item.educationLevel ?? null,
|
Level: item.educationLevel ?? "",
|
||||||
Degree: item.degree ?? null,
|
Degree: item.degree ?? "",
|
||||||
Field: item.field ?? null,
|
Field: item.field ?? "",
|
||||||
}));
|
}));
|
||||||
const salarys = await this.salaryRepository.find({
|
const salarys = await this.salaryRepository.find({
|
||||||
select: [
|
select: [
|
||||||
|
|
@ -445,7 +443,7 @@ export class ProfileController extends Controller {
|
||||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
}));
|
}));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
Profile,
|
Profile: [Profile],
|
||||||
Cert,
|
Cert,
|
||||||
Training,
|
Training,
|
||||||
Discipline,
|
Discipline,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue