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

View file

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