detail registry devlopment
This commit is contained in:
parent
212a3c3b0c
commit
501117fae1
1 changed files with 53 additions and 0 deletions
|
|
@ -483,4 +483,57 @@ export class KpiUserDevelopmentController extends Controller {
|
|||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดพัฒนาตนเอง
|
||||
*
|
||||
* @summary - รายละเอียดพัฒนาตนเอง #
|
||||
*
|
||||
* @param {string} id Id พัฒนาตนเอง
|
||||
*/
|
||||
@Get("registry/{type}/{id}")
|
||||
async GetKpiUserDevelopmentDetailRegistryOfficer(@Request() request: RequestWithUser, @Path() id: string, @Path() type: string) {
|
||||
const getKpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
|
||||
relations: ["kpiUserEvaluation", "developmentProjects"],
|
||||
where: { id: id },
|
||||
});
|
||||
if (!getKpiUserDevelopment) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลพัฒนาตนเองนี้");
|
||||
}
|
||||
if(type.trim().toLocaleUpperCase() == "OFFCIER"){
|
||||
await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", getKpiUserDevelopment.kpiUserEvaluation.profileId);
|
||||
}
|
||||
if(type.trim().toLocaleUpperCase() == "EMPLOYEE"){
|
||||
await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_EMP", getKpiUserDevelopment.kpiUserEvaluation.profileId);
|
||||
}
|
||||
if(type.trim().toLocaleUpperCase() == "TEMP"){
|
||||
await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_TEMP", getKpiUserDevelopment.kpiUserEvaluation.profileId);
|
||||
}else{
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถเข้าถึงข้อมูลนี้ได้");
|
||||
}
|
||||
|
||||
const mapKpiUserDevelopment = {
|
||||
id: getKpiUserDevelopment.id,
|
||||
evaluationId: getKpiUserDevelopment.kpiUserEvaluation.id,
|
||||
target: getKpiUserDevelopment.target,
|
||||
summary: getKpiUserDevelopment.summary,
|
||||
point: getKpiUserDevelopment.point,
|
||||
name: getKpiUserDevelopment.name,
|
||||
achievement10: getKpiUserDevelopment.achievement10,
|
||||
achievement5: getKpiUserDevelopment.achievement5,
|
||||
achievement0: getKpiUserDevelopment.achievement0,
|
||||
isDevelopment70: getKpiUserDevelopment.isDevelopment70,
|
||||
isDevelopment20: getKpiUserDevelopment.isDevelopment20,
|
||||
isDevelopment10: getKpiUserDevelopment.isDevelopment10,
|
||||
reasonDevelopment70: getKpiUserDevelopment.reasonDevelopment70,
|
||||
reasonDevelopment20: getKpiUserDevelopment.reasonDevelopment20,
|
||||
reasonDevelopment10: getKpiUserDevelopment.reasonDevelopment10,
|
||||
selectType: getKpiUserDevelopment.selectType,
|
||||
selectTypeYear: getKpiUserDevelopment.selectTypeYear,
|
||||
selectTypeId: getKpiUserDevelopment.selectTypeId,
|
||||
developmentProjects: getKpiUserDevelopment.developmentProjects.map((x) => x.name).sort(),
|
||||
};
|
||||
|
||||
return new HttpSuccess(mapKpiUserDevelopment);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue