get by root
This commit is contained in:
parent
87aa4a2b3d
commit
4398181192
1 changed files with 57 additions and 12 deletions
|
|
@ -6657,6 +6657,39 @@ export class ProfileController extends Controller {
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ข้อมูลสิทธิ์การแก้ไขทะเบียนประวัติ
|
||||||
|
*
|
||||||
|
* @summary ORG_065 - ข้อมูลสิทธิ์การแก้ไขทะเบียนประวัติ
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("keycloak/permissionProfile/{rootId}")
|
||||||
|
async getPermissionProfileByRoot(
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
@Path() rootId: string,
|
||||||
|
) {
|
||||||
|
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({
|
||||||
|
where: {
|
||||||
|
profileId: profile.id,
|
||||||
|
orgRootId: rootId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const _profile: any = {
|
||||||
|
profileId: profile?.id ?? null,
|
||||||
|
isEdit: permissionProflile?.isEdit ?? false,
|
||||||
|
isCheck: permissionProflile?.isCheck ?? false,
|
||||||
|
};
|
||||||
|
|
||||||
|
return new HttpSuccess(_profile);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ข้อมูลทะเบียนประวัติตาม keycloak
|
* API ข้อมูลทะเบียนประวัติตาม keycloak
|
||||||
*
|
*
|
||||||
|
|
@ -8932,18 +8965,30 @@ export class ProfileController extends Controller {
|
||||||
.orWhere(`orgRoot.orgRootName LIKE :keyword and profile.isProbation = ${isProbation}`, {
|
.orWhere(`orgRoot.orgRootName LIKE :keyword and profile.isProbation = ${isProbation}`, {
|
||||||
keyword: `%${body.keyword}%`,
|
keyword: `%${body.keyword}%`,
|
||||||
})
|
})
|
||||||
.orWhere(`orgChild1.orgChild1Name LIKE :keyword and profile.isProbation = ${isProbation}`, {
|
.orWhere(
|
||||||
keyword: `%${body.keyword}%`,
|
`orgChild1.orgChild1Name LIKE :keyword and profile.isProbation = ${isProbation}`,
|
||||||
})
|
{
|
||||||
.orWhere(`orgChild2.orgChild2Name LIKE :keyword and profile.isProbation = ${isProbation}`, {
|
keyword: `%${body.keyword}%`,
|
||||||
keyword: `%${body.keyword}%`,
|
},
|
||||||
})
|
)
|
||||||
.orWhere(`orgChild3.orgChild3Name LIKE :keyword and profile.isProbation = ${isProbation}`, {
|
.orWhere(
|
||||||
keyword: `%${body.keyword}%`,
|
`orgChild2.orgChild2Name LIKE :keyword and profile.isProbation = ${isProbation}`,
|
||||||
})
|
{
|
||||||
.orWhere(`orgChild4.orgChild4Name LIKE :keyword and profile.isProbation = ${isProbation}`, {
|
keyword: `%${body.keyword}%`,
|
||||||
keyword: `%${body.keyword}%`,
|
},
|
||||||
});
|
)
|
||||||
|
.orWhere(
|
||||||
|
`orgChild3.orgChild3Name LIKE :keyword and profile.isProbation = ${isProbation}`,
|
||||||
|
{
|
||||||
|
keyword: `%${body.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
|
`orgChild4.orgChild4Name LIKE :keyword and profile.isProbation = ${isProbation}`,
|
||||||
|
{
|
||||||
|
keyword: `%${body.keyword}%`,
|
||||||
|
},
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("profile.citizenId", "ASC")
|
.orderBy("profile.citizenId", "ASC")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue