API Get Profile ใช้อัพเดทสถานะ Mark ในระบบเครื่องราช
This commit is contained in:
parent
320dd4616c
commit
d3ad9468dc
1 changed files with 54 additions and 0 deletions
|
|
@ -4504,4 +4504,58 @@ export class OrganizationDotnetController extends Controller {
|
|||
};
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API Get Profile ใช้อัพเดทสถานะ Mark ในระบบเครื่องราช
|
||||
*
|
||||
* @summary API Get Profile ใช้อัพเดทสถานะ Mark ในระบบเครื่องราช
|
||||
*
|
||||
* @param {string} type ประเภท (ข้าราชการ หรือ ลูกจ้าง)
|
||||
*/
|
||||
@Post("find/insignia-requests-profile/{type}")
|
||||
async GetInsigniaRequestsProfileAsync(
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() type: string,
|
||||
@Body()
|
||||
body: {
|
||||
profileIds: string[];
|
||||
},
|
||||
) {
|
||||
let profile;
|
||||
if (type.trim().toLocaleUpperCase() == "OFFICER") {
|
||||
profile = await this.profileRepo.find({
|
||||
relations: [
|
||||
"profileSalary",
|
||||
"profileInsignias",
|
||||
"profileDisciplines",
|
||||
"profileAssessments"
|
||||
],
|
||||
where: { id: In(body.profileIds) }
|
||||
});
|
||||
}
|
||||
else {
|
||||
profile = await this.profileEmpRepo.find({
|
||||
relations: [
|
||||
"profileSalary",
|
||||
"profileInsignias",
|
||||
"profileDisciplines",
|
||||
"profileAssessments"
|
||||
],
|
||||
where: { id: In(body.profileIds) }
|
||||
});
|
||||
}
|
||||
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const mapProfile = profile.map((x) => {
|
||||
return {
|
||||
id: x.id,
|
||||
markDiscipline: x.profileDisciplines.length > 0 ? true : false,
|
||||
markLeave: false,
|
||||
markRate: x.profileAssessments.length > 0 ? true : false,
|
||||
markInsignia: x.profileInsignias.length > 0 ? true : false,
|
||||
};
|
||||
});
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue