Merge branch 'develop' into adiDev
This commit is contained in:
commit
7a54ad98ec
10 changed files with 463 additions and 158 deletions
|
|
@ -6408,7 +6408,7 @@ export class OrganizationController extends Controller {
|
|||
.filter(
|
||||
(x) =>
|
||||
x.orgChild1Id == null &&
|
||||
x.current_holderId != null &&
|
||||
// x.current_holderId != null &&
|
||||
x.posMasterOrder <= 3 &&
|
||||
x.isDirector === true,
|
||||
)
|
||||
|
|
@ -6455,7 +6455,7 @@ export class OrganizationController extends Controller {
|
|||
.filter(
|
||||
(x) =>
|
||||
x.orgChild2Id == null &&
|
||||
x.current_holderId != null &&
|
||||
// x.current_holderId != null &&
|
||||
x.posMasterOrder <= 3 &&
|
||||
x.isDirector === true,
|
||||
)
|
||||
|
|
@ -6510,7 +6510,7 @@ export class OrganizationController extends Controller {
|
|||
.filter(
|
||||
(x) =>
|
||||
x.orgChild3Id == null &&
|
||||
x.current_holderId != null &&
|
||||
// x.current_holderId != null &&
|
||||
x.posMasterOrder <= 3 &&
|
||||
x.isDirector === true,
|
||||
)
|
||||
|
|
@ -6572,7 +6572,7 @@ export class OrganizationController extends Controller {
|
|||
.filter(
|
||||
(x) =>
|
||||
x.orgChild4Id == null &&
|
||||
x.current_holderId != null &&
|
||||
// x.current_holderId != null &&
|
||||
x.posMasterOrder <= 3 &&
|
||||
x.isDirector === true,
|
||||
)
|
||||
|
|
@ -6640,9 +6640,8 @@ export class OrganizationController extends Controller {
|
|||
orgChild4.posMasters
|
||||
.filter(
|
||||
(x) =>
|
||||
x.current_holderId != null &&
|
||||
x.posMasterOrder <= 3 &&
|
||||
x.isDirector === true,
|
||||
// x.current_holderId != null &&
|
||||
x.posMasterOrder <= 3 && x.isDirector === true,
|
||||
)
|
||||
.map(async (x) => ({
|
||||
posmasterId: x.id,
|
||||
|
|
@ -8029,4 +8028,54 @@ export class OrganizationController extends Controller {
|
|||
}
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* API หา สกก1
|
||||
*
|
||||
* @summary - หา สกก1 (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Get("find/head/officer")
|
||||
async findIsHeadOfficer(@Request() request: RequestWithUser) {
|
||||
const posMaster = await this.posMasterRepository.find({
|
||||
where: {
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
orgRoot: { isCommission: true },
|
||||
isDirector: true,
|
||||
},
|
||||
order: { posMasterOrder: "ASC", posMasterActChilds: { posMasterOrder: "ASC" } },
|
||||
relations: [
|
||||
"current_holder",
|
||||
"posMasterActChilds",
|
||||
"posMasterActChilds.posMasterChild",
|
||||
"posMasterActChilds.posMasterChild.current_holder",
|
||||
],
|
||||
});
|
||||
if (posMaster.length <= 0) {
|
||||
return new HttpSuccess({
|
||||
name: "......................................................",
|
||||
position: "......................................................",
|
||||
});
|
||||
}
|
||||
if (posMaster[0].current_holder == null) {
|
||||
if (
|
||||
posMaster[0].posMasterActChilds.length <= 0 ||
|
||||
posMaster[0].posMasterActChilds[0].posMasterChild == null ||
|
||||
posMaster[0].posMasterActChilds[0].posMasterChild.current_holder == null
|
||||
) {
|
||||
return new HttpSuccess({
|
||||
name: "......................................................",
|
||||
position: "......................................................",
|
||||
});
|
||||
}
|
||||
return new HttpSuccess({
|
||||
name: `${posMaster[0].posMasterActChilds[0].posMasterChild.current_holder.prefix}${posMaster[0].posMasterActChilds[0].posMasterChild.current_holder.firstName} ${posMaster[0].posMasterActChilds[0].posMasterChild.current_holder.lastName}`,
|
||||
position: posMaster[0].posMasterActChilds[0].posMasterChild.current_holder.position,
|
||||
});
|
||||
} else {
|
||||
return new HttpSuccess({
|
||||
name: `${posMaster[0].current_holder.prefix}${posMaster[0].current_holder.firstName} ${posMaster[0].current_holder.lastName}`,
|
||||
position: posMaster[0].current_holder.position,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue