แก้ไข profile เพิ่มเติม

This commit is contained in:
AnandaTon 2024-05-29 15:51:58 +07:00
parent 857b0624f4
commit d96a6319b6

View file

@ -301,8 +301,7 @@ 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 : "",
@ -357,7 +356,7 @@ export class ProfileController extends Controller {
Division: "", Division: "",
Institute: "", Institute: "",
StartDate: profiles?.dateStart, StartDate: profiles?.dateStart,
AppointDate: profiles?.dateAppoint, AppointDate: profiles?.dateAppoint ?? "",
BirthDate: profiles?.birthDate BirthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
: null, : null,
@ -366,8 +365,7 @@ export class ProfileController extends Controller {
? Extension.ToThaiNumber(profiles.dateRetireLaw.toString()) ? Extension.ToThaiNumber(profiles.dateRetireLaw.toString())
: "", : "",
// AvatarId: profiles?.avatar ?? null, // 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,