Merge branch 'develop' into develop-Bright
This commit is contained in:
commit
322c2f3665
2 changed files with 41 additions and 13 deletions
|
|
@ -535,6 +535,7 @@ export class ProfileController extends Controller {
|
||||||
const certs = await this.certificateRepository.find({
|
const certs = await this.certificateRepository.find({
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
|
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const Cert =
|
const Cert =
|
||||||
certs.length > 0
|
certs.length > 0
|
||||||
|
|
@ -555,6 +556,7 @@ export class ProfileController extends Controller {
|
||||||
const trainings = await this.trainingRepository.find({
|
const trainings = await this.trainingRepository.find({
|
||||||
select: ["startDate", "endDate", "place", "department", "name"],
|
select: ["startDate", "endDate", "place", "department", "name"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const Training =
|
const Training =
|
||||||
trainings.length > 0
|
trainings.length > 0
|
||||||
|
|
@ -591,6 +593,7 @@ export class ProfileController extends Controller {
|
||||||
const disciplines = await this.disciplineRepository.find({
|
const disciplines = await this.disciplineRepository.find({
|
||||||
select: ["refCommandDate", "refCommandNo", "detail"],
|
select: ["refCommandDate", "refCommandNo", "detail"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const Discipline =
|
const Discipline =
|
||||||
disciplines.length > 0
|
disciplines.length > 0
|
||||||
|
|
@ -612,7 +615,8 @@ export class ProfileController extends Controller {
|
||||||
const educations = await this.educationRepository.find({
|
const educations = await this.educationRepository.find({
|
||||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
||||||
where: { profileId: id },
|
where: { profileId: id },
|
||||||
order: { lastUpdatedAt: "DESC" },
|
// order: { lastUpdatedAt: "DESC" },
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
const Education =
|
const Education =
|
||||||
educations.length > 0
|
educations.length > 0
|
||||||
|
|
@ -765,6 +769,10 @@ export class ProfileController extends Controller {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// const data = {
|
||||||
|
// FullName: ,
|
||||||
|
// };
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
Profile: [Profile],
|
Profile: [Profile],
|
||||||
Cert,
|
Cert,
|
||||||
|
|
@ -775,6 +783,11 @@ export class ProfileController extends Controller {
|
||||||
Insignia,
|
Insignia,
|
||||||
Leave,
|
Leave,
|
||||||
});
|
});
|
||||||
|
// return new HttpSuccess({
|
||||||
|
// template: "kk1",
|
||||||
|
// reportName: "docx-report",
|
||||||
|
// data: data,
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -2747,18 +2760,22 @@ export class ProfileController extends Controller {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastestData = await this.profileFamilyFatherRepository.findOne({
|
let lastestData:any = await this.profileFamilyFatherRepository.findOne({
|
||||||
where:{ profileId:id },
|
where:{ profileId:id },
|
||||||
order:{ createdAt: "DESC" }
|
order:{ createdAt: "DESC" }
|
||||||
});
|
});
|
||||||
if (!lastestData) {
|
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบข้อมูลดังกล่าว");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(body).forEach((key) => {
|
Object.keys(body).forEach((key) => {
|
||||||
const typedKey = key as keyof UpdateProfileFather; // บอก TypeScript ว่า key เป็นฟิลด์ของ UpdateProfileFather
|
const typedKey = key as keyof UpdateProfileFather; // บอก TypeScript ว่า key เป็นฟิลด์ของ UpdateProfileFather
|
||||||
if (body[typedKey] === null || body[typedKey] === "") delete body[typedKey];
|
if (body[typedKey] === null || body[typedKey] === "") delete body[typedKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!lastestData) {
|
||||||
|
lastestData = new ProfileFamilyFather();
|
||||||
|
Object.assign(lastestData, body);
|
||||||
|
lastestData.profileId = id;
|
||||||
|
}
|
||||||
|
|
||||||
Object.assign(lastestData, body);
|
Object.assign(lastestData, body);
|
||||||
lastestData.createdUserId = req.user.sub;
|
lastestData.createdUserId = req.user.sub;
|
||||||
lastestData.createdFullName = req.user.name;
|
lastestData.createdFullName = req.user.name;
|
||||||
|
|
@ -2795,18 +2812,22 @@ export class ProfileController extends Controller {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastestData = await this.profileFamilyMotherRepository.findOne({
|
let lastestData = await this.profileFamilyMotherRepository.findOne({
|
||||||
where:{ profileId:id },
|
where:{ profileId:id },
|
||||||
order:{ createdAt: "DESC" }
|
order:{ createdAt: "DESC" }
|
||||||
});
|
});
|
||||||
if (!lastestData) {
|
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบข้อมูลดังกล่าว");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(body).forEach((key) => {
|
Object.keys(body).forEach((key) => {
|
||||||
const typedKey = key as keyof UpdateProfileMother; // บอก TypeScript ว่า key เป็นฟิลด์ของ UpdateProfileMother
|
const typedKey = key as keyof UpdateProfileMother; // บอก TypeScript ว่า key เป็นฟิลด์ของ UpdateProfileMother
|
||||||
if (body[typedKey] === null || body[typedKey] === "") delete body[typedKey];
|
if (body[typedKey] === null || body[typedKey] === "") delete body[typedKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!lastestData) {
|
||||||
|
lastestData = new ProfileFamilyMother();
|
||||||
|
Object.assign(lastestData, body);
|
||||||
|
lastestData.profileId = id;
|
||||||
|
}
|
||||||
|
|
||||||
Object.assign(lastestData, body);
|
Object.assign(lastestData, body);
|
||||||
lastestData.createdUserId = req.user.sub;
|
lastestData.createdUserId = req.user.sub;
|
||||||
lastestData.createdFullName = req.user.name;
|
lastestData.createdFullName = req.user.name;
|
||||||
|
|
@ -2843,18 +2864,22 @@ export class ProfileController extends Controller {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastestData = await this.profileFamilyCoupleRepository.findOne({
|
let lastestData = await this.profileFamilyCoupleRepository.findOne({
|
||||||
where:{ profileId:id },
|
where:{ profileId:id },
|
||||||
order:{ createdAt: "DESC" }
|
order:{ createdAt: "DESC" }
|
||||||
});
|
});
|
||||||
if (!lastestData) {
|
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบข้อมูลดังกล่าว");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(body).forEach((key) => {
|
Object.keys(body).forEach((key) => {
|
||||||
const typedKey = key as keyof UpdateProfileCouple; // บอก TypeScript ว่า key เป็นฟิลด์ของ UpdateProfileCouple
|
const typedKey = key as keyof UpdateProfileCouple; // บอก TypeScript ว่า key เป็นฟิลด์ของ UpdateProfileCouple
|
||||||
if (body[typedKey] === null || body[typedKey] === "") delete body[typedKey];
|
if (body[typedKey] === null || body[typedKey] === "") delete body[typedKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!lastestData) {
|
||||||
|
lastestData = new ProfileFamilyCouple();
|
||||||
|
Object.assign(lastestData, body);
|
||||||
|
lastestData.profileId = id;
|
||||||
|
}
|
||||||
|
|
||||||
Object.assign(lastestData, body);
|
Object.assign(lastestData, body);
|
||||||
lastestData.createdUserId = req.user.sub;
|
lastestData.createdUserId = req.user.sub;
|
||||||
lastestData.createdFullName = req.user.name;
|
lastestData.createdFullName = req.user.name;
|
||||||
|
|
|
||||||
|
|
@ -773,6 +773,7 @@ export type UpdateProfileFather = {
|
||||||
fatherLastName?: string | null;
|
fatherLastName?: string | null;
|
||||||
fatherCareer?: string | null;
|
fatherCareer?: string | null;
|
||||||
fatherLive?: boolean | null;
|
fatherLive?: boolean | null;
|
||||||
|
fatherCitizenId?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateProfileMother = {
|
export type UpdateProfileMother = {
|
||||||
|
|
@ -781,6 +782,7 @@ export type UpdateProfileMother = {
|
||||||
motherLastName?: string | null;
|
motherLastName?: string | null;
|
||||||
motherCareer?: string | null;
|
motherCareer?: string | null;
|
||||||
motherLive?: boolean | null;
|
motherLive?: boolean | null;
|
||||||
|
motherCitizenId?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateProfileCouple = {
|
export type UpdateProfileCouple = {
|
||||||
|
|
@ -791,6 +793,7 @@ export type UpdateProfileCouple = {
|
||||||
coupleCareer?: string | null;
|
coupleCareer?: string | null;
|
||||||
coupleLive?: boolean | null;
|
coupleLive?: boolean | null;
|
||||||
relationship?: string | null;
|
relationship?: string | null;
|
||||||
|
coupleCitizenId?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateProfileAddress = {
|
export type UpdateProfileAddress = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue