Merge branch 'develop' into adiDev
This commit is contained in:
commit
f6e01f95a2
1 changed files with 183 additions and 151 deletions
|
|
@ -295,157 +295,6 @@ export class OrganizationDotnetController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const org = {
|
|
||||||
root:
|
|
||||||
profile?.current_holders?.find(
|
|
||||||
(x) =>
|
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
|
||||||
)?.orgRoot?.id ?? null,
|
|
||||||
child1:
|
|
||||||
profile?.current_holders?.find(
|
|
||||||
(x) =>
|
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
|
||||||
)?.orgChild1?.id ?? null,
|
|
||||||
child2:
|
|
||||||
profile?.current_holders?.find(
|
|
||||||
(x) =>
|
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
|
||||||
)?.orgChild2?.id ?? null,
|
|
||||||
child3:
|
|
||||||
profile?.current_holders?.find(
|
|
||||||
(x) =>
|
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
|
||||||
)?.orgChild3?.id ?? null,
|
|
||||||
child4:
|
|
||||||
profile?.current_holders?.find(
|
|
||||||
(x) =>
|
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
|
||||||
)?.orgChild4?.id ?? null,
|
|
||||||
};
|
|
||||||
|
|
||||||
let fullname = "";
|
|
||||||
let pos = await this.posMasterRepository.findOne({
|
|
||||||
relations: ["current_holder"],
|
|
||||||
where: {
|
|
||||||
orgRevision: {
|
|
||||||
orgRevisionIsCurrent: true,
|
|
||||||
orgRevisionIsDraft: false,
|
|
||||||
},
|
|
||||||
isDirector: true,
|
|
||||||
orgRootId: org?.root ?? "",
|
|
||||||
orgChild1Id: org?.child1 ?? "",
|
|
||||||
orgChild2Id: org?.child2 ?? "",
|
|
||||||
orgChild3Id: org?.child3 ?? "",
|
|
||||||
orgChild4Id: org?.child4 ?? "",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (pos) {
|
|
||||||
fullname =
|
|
||||||
pos.current_holder.prefix +
|
|
||||||
pos.current_holder.firstName +
|
|
||||||
" " +
|
|
||||||
pos.current_holder.lastName;
|
|
||||||
} else {
|
|
||||||
let pos = await this.posMasterRepository.findOne({
|
|
||||||
relations: ["current_holder"],
|
|
||||||
where: {
|
|
||||||
orgRevision: {
|
|
||||||
orgRevisionIsCurrent: true,
|
|
||||||
orgRevisionIsDraft: false,
|
|
||||||
},
|
|
||||||
isDirector: true,
|
|
||||||
orgRootId: org?.root ?? "",
|
|
||||||
orgChild1Id: org?.child1 ?? "",
|
|
||||||
orgChild2Id: org?.child2 ?? "",
|
|
||||||
orgChild3Id: org?.child3 ?? "",
|
|
||||||
orgChild4Id: IsNull(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (pos) {
|
|
||||||
fullname =
|
|
||||||
pos.current_holder.prefix +
|
|
||||||
pos.current_holder.firstName +
|
|
||||||
" " +
|
|
||||||
pos.current_holder.lastName;
|
|
||||||
} else {
|
|
||||||
let pos = await this.posMasterRepository.findOne({
|
|
||||||
relations: ["current_holder"],
|
|
||||||
where: {
|
|
||||||
orgRevision: {
|
|
||||||
orgRevisionIsCurrent: true,
|
|
||||||
orgRevisionIsDraft: false,
|
|
||||||
},
|
|
||||||
isDirector: true,
|
|
||||||
orgRootId: org?.root ?? "",
|
|
||||||
orgChild1Id: org?.child1 ?? "",
|
|
||||||
orgChild2Id: org?.child2 ?? "",
|
|
||||||
orgChild3Id: IsNull(),
|
|
||||||
orgChild4Id: IsNull(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (pos) {
|
|
||||||
fullname =
|
|
||||||
pos.current_holder.prefix +
|
|
||||||
pos.current_holder.firstName +
|
|
||||||
" " +
|
|
||||||
pos.current_holder.lastName;
|
|
||||||
} else {
|
|
||||||
let pos = await this.posMasterRepository.findOne({
|
|
||||||
relations: ["current_holder"],
|
|
||||||
where: {
|
|
||||||
orgRevision: {
|
|
||||||
orgRevisionIsCurrent: true,
|
|
||||||
orgRevisionIsDraft: false,
|
|
||||||
},
|
|
||||||
isDirector: true,
|
|
||||||
orgRootId: org?.root ?? "",
|
|
||||||
orgChild1Id: org?.child1 ?? "",
|
|
||||||
orgChild2Id: IsNull(),
|
|
||||||
orgChild3Id: IsNull(),
|
|
||||||
orgChild4Id: IsNull(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (pos) {
|
|
||||||
fullname =
|
|
||||||
pos.current_holder.prefix +
|
|
||||||
pos.current_holder.firstName +
|
|
||||||
" " +
|
|
||||||
pos.current_holder.lastName;
|
|
||||||
} else {
|
|
||||||
let pos = await this.posMasterRepository.findOne({
|
|
||||||
relations: ["current_holder"],
|
|
||||||
where: {
|
|
||||||
orgRevision: {
|
|
||||||
orgRevisionIsCurrent: true,
|
|
||||||
orgRevisionIsDraft: false,
|
|
||||||
},
|
|
||||||
orgRootId: org?.root ?? "",
|
|
||||||
orgChild1Id: IsNull(),
|
|
||||||
orgChild2Id: IsNull(),
|
|
||||||
orgChild3Id: IsNull(),
|
|
||||||
orgChild4Id: IsNull(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (pos) {
|
|
||||||
fullname =
|
|
||||||
pos.current_holder.prefix +
|
|
||||||
pos.current_holder.firstName +
|
|
||||||
" " +
|
|
||||||
pos.current_holder.lastName;
|
|
||||||
} else {
|
|
||||||
fullname = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
const profile = await this.profileEmpRepo.findOne({
|
const profile = await this.profileEmpRepo.findOne({
|
||||||
relations: [
|
relations: [
|
||||||
|
|
@ -473,6 +322,38 @@ export class OrganizationDotnetController extends Controller {
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
|
const org = {
|
||||||
|
root:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgRoot?.id ?? null,
|
||||||
|
child1:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild1?.id ?? null,
|
||||||
|
child2:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild2?.id ?? null,
|
||||||
|
child3:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild3?.id ?? null,
|
||||||
|
child4:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild4?.id ?? null,
|
||||||
|
};
|
||||||
let fullname = "";
|
let fullname = "";
|
||||||
let pos = await this.posMasterRepository.findOne({
|
let pos = await this.posMasterRepository.findOne({
|
||||||
relations: ["current_holder"],
|
relations: ["current_holder"],
|
||||||
|
|
@ -675,6 +556,157 @@ export class OrganizationDotnetController extends Controller {
|
||||||
return new HttpSuccess(mapProfile);
|
return new HttpSuccess(mapProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const org = {
|
||||||
|
root:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgRoot?.id ?? null,
|
||||||
|
child1:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild1?.id ?? null,
|
||||||
|
child2:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild2?.id ?? null,
|
||||||
|
child3:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild3?.id ?? null,
|
||||||
|
child4:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild4?.id ?? null,
|
||||||
|
};
|
||||||
|
|
||||||
|
let fullname = "";
|
||||||
|
let pos = await this.posMasterRepository.findOne({
|
||||||
|
relations: ["current_holder"],
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false,
|
||||||
|
},
|
||||||
|
isDirector: true,
|
||||||
|
orgRootId: org?.root ?? "",
|
||||||
|
orgChild1Id: org?.child1 ?? "",
|
||||||
|
orgChild2Id: org?.child2 ?? "",
|
||||||
|
orgChild3Id: org?.child3 ?? "",
|
||||||
|
orgChild4Id: org?.child4 ?? "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (pos) {
|
||||||
|
fullname =
|
||||||
|
pos.current_holder.prefix +
|
||||||
|
pos.current_holder.firstName +
|
||||||
|
" " +
|
||||||
|
pos.current_holder.lastName;
|
||||||
|
} else {
|
||||||
|
let pos = await this.posMasterRepository.findOne({
|
||||||
|
relations: ["current_holder"],
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false,
|
||||||
|
},
|
||||||
|
isDirector: true,
|
||||||
|
orgRootId: org?.root ?? "",
|
||||||
|
orgChild1Id: org?.child1 ?? "",
|
||||||
|
orgChild2Id: org?.child2 ?? "",
|
||||||
|
orgChild3Id: org?.child3 ?? "",
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (pos) {
|
||||||
|
fullname =
|
||||||
|
pos.current_holder.prefix +
|
||||||
|
pos.current_holder.firstName +
|
||||||
|
" " +
|
||||||
|
pos.current_holder.lastName;
|
||||||
|
} else {
|
||||||
|
let pos = await this.posMasterRepository.findOne({
|
||||||
|
relations: ["current_holder"],
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false,
|
||||||
|
},
|
||||||
|
isDirector: true,
|
||||||
|
orgRootId: org?.root ?? "",
|
||||||
|
orgChild1Id: org?.child1 ?? "",
|
||||||
|
orgChild2Id: org?.child2 ?? "",
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (pos) {
|
||||||
|
fullname =
|
||||||
|
pos.current_holder.prefix +
|
||||||
|
pos.current_holder.firstName +
|
||||||
|
" " +
|
||||||
|
pos.current_holder.lastName;
|
||||||
|
} else {
|
||||||
|
let pos = await this.posMasterRepository.findOne({
|
||||||
|
relations: ["current_holder"],
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false,
|
||||||
|
},
|
||||||
|
isDirector: true,
|
||||||
|
orgRootId: org?.root ?? "",
|
||||||
|
orgChild1Id: org?.child1 ?? "",
|
||||||
|
orgChild2Id: IsNull(),
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (pos) {
|
||||||
|
fullname =
|
||||||
|
pos.current_holder.prefix +
|
||||||
|
pos.current_holder.firstName +
|
||||||
|
" " +
|
||||||
|
pos.current_holder.lastName;
|
||||||
|
} else {
|
||||||
|
let pos = await this.posMasterRepository.findOne({
|
||||||
|
relations: ["current_holder"],
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false,
|
||||||
|
},
|
||||||
|
orgRootId: org?.root ?? "",
|
||||||
|
orgChild1Id: IsNull(),
|
||||||
|
orgChild2Id: IsNull(),
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (pos) {
|
||||||
|
fullname =
|
||||||
|
pos.current_holder.prefix +
|
||||||
|
pos.current_holder.firstName +
|
||||||
|
" " +
|
||||||
|
pos.current_holder.lastName;
|
||||||
|
} else {
|
||||||
|
fullname = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mapProfile = {
|
const mapProfile = {
|
||||||
id: profile.id,
|
id: profile.id,
|
||||||
avatar: profile.avatar,
|
avatar: profile.avatar,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue