find isCommission
This commit is contained in:
parent
e1e400a24a
commit
54c847cdd6
1 changed files with 46 additions and 0 deletions
|
|
@ -8024,4 +8024,50 @@ export class OrganizationController extends Controller {
|
||||||
}
|
}
|
||||||
return data;
|
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 },
|
||||||
|
},
|
||||||
|
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