From 64792a698d0bfff93b3e5f9e006c89f95c3bee64 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 5 Sep 2024 11:05:02 +0700 Subject: [PATCH] no message --- src/controllers/ProfileController.ts | 26 +++++++-------- src/controllers/ProfileEmployeeController.ts | 35 +++++++++++--------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 4792967e..94730a32 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -199,47 +199,47 @@ export class ProfileController extends Controller { order: { lastUpdatedAt: "DESC" }, }); const Education = educations.map((item) => ({ - Institute: item.institute, + Institute: item.institute ? item.institute : "-", Date: item.startDate && item.endDate ? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}` - : "", - Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "", + : "-", + Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-", })); const mapData = { Id: profile.id, - CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "", - Prefix: profile.prefix != null ? profile.prefix : "", - FirstName: profile.firstName != null ? profile.firstName : "", - LastName: profile.lastName != null ? profile.lastName : "", + CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-", + Prefix: profile.prefix != null ? profile.prefix : null, + FirstName: profile.firstName != null ? profile.firstName : null, + LastName: profile.lastName != null ? profile.lastName : null, DateOfBirth: profile.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate)) - : "", + : "-", DateRetire: profile.dateRetire != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire)) - : "", + : "-", RegistrationAddress: Extension.ToThaiNumber( `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`, ), SalaryAmount: profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null ? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString()) - : "", + : "-", Education: Education, AppointText: profile.dateAppoint != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint)) - : "", + : "-", SalaryDate: profile.profileSalary.length > 0 && profile.profileSalary[0].date != null ? Extension.ToThaiNumber( Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date), ) - : "", - PositionName: profile.position != null ? profile.position : "", + : "-", + PositionName: profile.position != null ? profile.position : "-", OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`, }; diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index f284d70e..b2366f07 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -205,44 +205,47 @@ export class ProfileEmployeeController extends Controller { order: { lastUpdatedAt: "DESC" }, }); const Education = educations.map((item) => ({ - Institute: item.institute, + Institute: item.institute ? item.institute : "-", Date: item.startDate && item.endDate ? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}` - : "", - Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "", + : "-", + Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-", })); const mapData = { Id: profile.id, - CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "", - Prefix: profile.prefix != null ? profile.prefix : "", - FirstName: profile.firstName != null ? profile.firstName : "", - LastName: profile.lastName != null ? profile.lastName : "", + CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "-", + Prefix: profile.prefix != null ? profile.prefix : null, + FirstName: profile.firstName != null ? profile.firstName : null, + LastName: profile.lastName != null ? profile.lastName : null, DateOfBirth: profile.birthDate != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.birthDate)) - : "", + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate)) + : "-", DateRetire: profile.dateRetire != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateRetire)) - : "", + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire)) + : "-", RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`, SalaryAmount: profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null ? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString()) - : "", + : "-", Education: Education, // profile.profileEducations.length > 0 && // profile.profileEducations[profile.profileEducations.length - 1].institute != null // ? profile.profileEducations[profile.profileEducations.length - 1].institute // : "", - AppointText: profile.dateAppoint != null ? profile.dateAppoint : "", + AppointText: + profile.dateAppoint != null + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint)) + : "-", SalaryDate: profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalarys[0].date)) - : "", - PositionName: profile.position != null ? profile.position : "", + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.profileSalarys[0].date)) + : "-", + PositionName: profile.position != null ? profile.position : "-", OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`, };