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: [