fix GET user-oc > return dnaId
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m14s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m14s
This commit is contained in:
parent
cd057bf81d
commit
ac9dc93d1e
1 changed files with 23 additions and 5 deletions
|
|
@ -4792,7 +4792,16 @@ export class OrganizationDotnetController extends Controller {
|
||||||
async getProfileByKeycloak(@Path() keycloakId: string) {
|
async getProfileByKeycloak(@Path() keycloakId: string) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { keycloak: keycloakId },
|
where: { keycloak: keycloakId },
|
||||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
relations: [
|
||||||
|
"posLevel",
|
||||||
|
"posType",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
],
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||||
|
|
@ -4807,11 +4816,16 @@ export class OrganizationDotnetController extends Controller {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||||
}
|
}
|
||||||
|
|
||||||
const root =
|
const holder =
|
||||||
profile.current_holders == null ||
|
profile.current_holders == null
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) ?? null;
|
||||||
|
|
||||||
|
const root = holder?.orgRoot ?? null;
|
||||||
|
const child1 = holder?.orgChild1 ?? null;
|
||||||
|
const child2 = holder?.orgChild2 ?? null;
|
||||||
|
const child3 = holder?.orgChild3 ?? null;
|
||||||
|
const child4 = holder?.orgChild4 ?? null;
|
||||||
|
|
||||||
const _profile: any = {
|
const _profile: any = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
|
|
@ -4828,6 +4842,10 @@ export class OrganizationDotnetController extends Controller {
|
||||||
root: root == null ? null : root.orgRootName,
|
root: root == null ? null : root.orgRootName,
|
||||||
rootShortName: root == null ? null : root.orgRootShortName,
|
rootShortName: root == null ? null : root.orgRootShortName,
|
||||||
rootDnaId: root == null ? null : root.ancestorDNA,
|
rootDnaId: root == null ? null : root.ancestorDNA,
|
||||||
|
child1DnaId: child1 == null ? null : child1.ancestorDNA,
|
||||||
|
child2DnaId: child2 == null ? null : child2.ancestorDNA,
|
||||||
|
child3DnaId: child3 == null ? null : child3.ancestorDNA,
|
||||||
|
child4DnaId: child4 == null ? null : child4.ancestorDNA,
|
||||||
};
|
};
|
||||||
return new HttpSuccess(_profile);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue