add api permissionProfile
This commit is contained in:
parent
4e29c6cd71
commit
c2b566792d
1 changed files with 44 additions and 0 deletions
|
|
@ -6167,6 +6167,50 @@ export class ProfileController extends Controller {
|
||||||
return new HttpSuccess(mapData);
|
return new HttpSuccess(mapData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ข้อมูลสิทธิ์การแก้ไขทะเบียนประวัติ
|
||||||
|
*
|
||||||
|
* @summary ORG_065 - ข้อมูลสิทธิ์การแก้ไขทะเบียนประวัติ
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("keycloak/permissionProfile")
|
||||||
|
async getPermissionProfile(
|
||||||
|
@Request() request: { user: Record<string, any> }
|
||||||
|
) {
|
||||||
|
let orgRevisionPublish: any = await this.orgRevisionRepo
|
||||||
|
.createQueryBuilder("orgRevision")
|
||||||
|
.where("orgRevision.orgRevisionIsDraft = false")
|
||||||
|
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
||||||
|
.getOne();
|
||||||
|
if (!orgRevisionPublish) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||||
|
}
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
where: {keycloak: request.user.sub },
|
||||||
|
});
|
||||||
|
if(!profile){
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้");
|
||||||
|
}
|
||||||
|
const permissionProflile = await this.permissionProflileRepository.findOne({
|
||||||
|
relations : ["orgRootTree"],
|
||||||
|
where:{
|
||||||
|
profileId: profile.id,
|
||||||
|
orgRootTree:{
|
||||||
|
orgRevisionId: orgRevisionPublish.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const _profile: any = {
|
||||||
|
profileId: profile?.id??null,
|
||||||
|
isEdit: permissionProflile?.isEdit??false,
|
||||||
|
isCheck: permissionProflile?.isCheck??false,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return new HttpSuccess(_profile);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ข้อมูลทะเบียนประวัติตาม keycloak
|
* API ข้อมูลทะเบียนประวัติตาม keycloak
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue