แก้ไข type เป๊น String

This commit is contained in:
AnandaTon 2024-05-29 11:00:13 +07:00
parent 4d9053dcdc
commit c64ffd8ea8
2 changed files with 23 additions and 18 deletions

View file

@ -307,13 +307,15 @@ export class ProfileController extends Controller {
FirstName: profiles?.firstName != null ? profiles.firstName : "",
LastName: profiles?.lastName != null ? profiles.lastName : "",
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate() : null,
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate().toString() : null,
BirthDayText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
: "",
BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null,
BirthMonth: profiles?.birthDate
? new Date(profiles.birthDate).getMonth() + (1).toString()
: null, // Months are zero-based
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear().toString() : null,
BirthYearText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
@ -374,8 +376,8 @@ export class ProfileController extends Controller {
});
const Training = trainings.map((item) => ({
institute: item.department ?? null,
start: Extension.ToThaiShortDate(item.startDate) ?? null,
end: Extension.ToThaiShortDate(item.endDate) ?? null,
start: Extension.ToThaiShortDate(item.startDate).toString() ?? null,
end: Extension.ToThaiShortDate(item.endDate).toString() ?? null,
level: "",
degree: "",
field: item.place ?? null,
@ -386,7 +388,7 @@ export class ProfileController extends Controller {
where: { profileId: id },
});
const Discipline = disciplines.map((item) => ({
DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null,
DisciplineYear: new Date(item.refCommandDate).getFullYear().toString() ?? null,
DisciplineDetail: item.detail ?? null,
RefNo: item.refCommandNo ?? null,
}));
@ -397,8 +399,8 @@ export class ProfileController extends Controller {
});
const Education = educations.map((item) => ({
Institute: item.institute ?? null,
Start: new Date(item.startDate).getFullYear() ?? null,
End: new Date(item.endDate).getFullYear() ?? null,
Start: new Date(item.startDate).getFullYear().toString() ?? null,
End: new Date(item.endDate).getFullYear().toString() ?? null,
Level: item.educationLevel ?? null,
Degree: item.degree ?? null,
Field: item.field ?? null,
@ -424,7 +426,8 @@ export class ProfileController extends Controller {
RefAll: item.refCommandNo ?? null,
PositionType: item.positionType ?? null,
PositionLevel: item.positionLevel ?? null,
PositionAmount: item.positionSalaryAmount == null? null: item.positionSalaryAmount.toString(),
PositionAmount:
item.positionSalaryAmount == null ? null : item.positionSalaryAmount.toString(),
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
}));

View file

@ -320,13 +320,15 @@ export class ProfileEmployeeController extends Controller {
FirstName: profiles?.firstName != null ? profiles.firstName : "",
LastName: profiles?.lastName != null ? profiles.lastName : "",
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate() : null,
BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate().toString() : null,
BirthDayText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
: "",
BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null,
BirthMonth: profiles?.birthDate
? new Date(profiles.birthDate).getMonth() + (1).toString()
: null, // Months are zero-based
BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear().toString() : null,
BirthYearText:
profiles.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
@ -368,7 +370,7 @@ export class ProfileEmployeeController extends Controller {
AppointDate: profiles?.dateAppoint,
BirthDate: profiles?.birthDate ? Extension.ToThaiShortDate(profiles.birthDate) : null,
RetireDate: profiles?.dateRetireLaw,
AvatarId: profiles?.avatar ?? null,
// AvatarId: profiles?.avatar ?? null,
};
const certs = await this.certificateRepository.find({
@ -387,8 +389,8 @@ export class ProfileEmployeeController extends Controller {
});
const Training = trainings.map((item) => ({
institute: item.department ?? null,
start: Extension.ToThaiShortDate(item.startDate) ?? null,
end: Extension.ToThaiShortDate(item.endDate) ?? null,
start: Extension.ToThaiShortDate(item.startDate).toString() ?? null,
end: Extension.ToThaiShortDate(item.endDate).toString() ?? null,
level: "",
degree: "",
field: item.place ?? null,
@ -399,7 +401,7 @@ export class ProfileEmployeeController extends Controller {
where: { profileEmployeeId: id },
});
const Discipline = disciplines.map((item) => ({
DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null,
DisciplineYear: new Date(item.refCommandDate).getFullYear().toString() ?? null,
DisciplineDetail: item.detail ?? null,
RefNo: item.refCommandNo ?? null,
}));
@ -410,8 +412,8 @@ export class ProfileEmployeeController extends Controller {
});
const Education = educations.map((item) => ({
Institute: item.institute ?? null,
Start: new Date(item.startDate).getFullYear() ?? null,
End: new Date(item.endDate).getFullYear() ?? null,
Start: new Date(item.startDate).getFullYear().toString() ?? null,
End: new Date(item.endDate).getFullYear().toString() ?? null,
Level: item.educationLevel ?? null,
Degree: item.degree ?? null,
Field: item.field ?? null,