From 0e8be06181ab74b7dbfbdb15f4231e1a89401745 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Wed, 29 May 2024 16:59:52 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=20education=20=E0=B9=83=E0=B8=99=20profile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index f539e683..ca04f84a 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -383,8 +383,14 @@ export class ProfileController extends Controller { }); const Training = trainings.map((item) => ({ Institute: item.department ?? "", - Start: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()) ?? "", - End: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()) ?? "", + Start: + item.startDate == null + ? "" + : Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate).toString()), + End: + item.endDate == null + ? "" + : Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate).toString()), Level: "", Degree: "", Field: item.place ?? "", @@ -406,12 +412,18 @@ export class ProfileController extends Controller { where: { profileId: id }, }); const Education = educations.map((item) => ({ - Institute: item.institute ?? "", - Start: Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()) ?? null, - End: Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()) ?? null, + Institute: item.institute, + Start: + item.startDate == null + ? "" + : Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()), + End: + item.endDate == null + ? "" + : Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()), Level: item.educationLevel ?? "", - Degree: item.degree ?? "", - Field: item.field ?? "", + Degree: item.degree, + Field: item.field ?? "-", })); const salarys = await this.salaryRepository.find({ select: [