add isDeputy

This commit is contained in:
kittapath 2024-10-21 17:11:21 +07:00
parent 96edba3c08
commit 7aeafcd723
4 changed files with 83 additions and 0 deletions

View file

@ -732,6 +732,7 @@ export class OrganizationController extends Controller {
// )
.select([
"orgRoot.id",
"orgRoot.isDeputy",
"orgRoot.orgRootName",
"orgRoot.orgRootShortName",
"orgRoot.orgRootCode",
@ -906,6 +907,7 @@ export class OrganizationController extends Controller {
orgRootName: orgRoot.orgRootName,
responsibility: orgRoot.responsibility,
isOfficer: false,
isDeputy: orgRoot.isDeputy,
labelName:
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
totalPosition: await this.posMasterRepository.count({
@ -1552,6 +1554,7 @@ export class OrganizationController extends Controller {
})
.select([
"orgRoot.id",
"orgRoot.isDeputy",
"orgRoot.orgRootName",
"orgRoot.orgRootShortName",
"orgRoot.orgRootCode",
@ -1685,6 +1688,7 @@ export class OrganizationController extends Controller {
orgTreeFax: orgRoot.orgRootFax,
orgRevisionId: orgRoot.orgRevisionId,
orgRootName: orgRoot.orgRootName,
isDeputy: orgRoot.isDeputy,
responsibility: orgRoot.responsibility,
labelName:
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
@ -2322,6 +2326,7 @@ export class OrganizationController extends Controller {
)
.select([
"orgRoot.id",
"orgRoot.isDeputy",
"orgRoot.orgRootName",
"orgRoot.orgRootShortName",
"orgRoot.orgRootCode",
@ -2495,6 +2500,7 @@ export class OrganizationController extends Controller {
orgTreeFax: orgRoot.orgRootFax,
orgRevisionId: orgRoot.orgRevisionId,
orgRootName: orgRoot.orgRootName,
isDeputy:orgRoot.isDeputy,
responsibility: orgRoot.responsibility,
labelName:
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
@ -6606,6 +6612,24 @@ export class OrganizationController extends Controller {
const check = orgRevision.orgChild1s.find((x) => x.isOfficer == true);
return new HttpSuccess(check != null);
}
/**
* API org
*
* @summary - org (ADMIN)
*
*/
@Get("check/root/{id}")
async findIsDeputyRoot(@Path() id: string, @Request() request: RequestWithUser) {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { id },
relations: ["orgRoots"],
});
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const check = orgRevision.orgRoots.find((x) => x.isDeputy == true);
return new HttpSuccess(check != null);
}
public async listAuthSysOrgFuncByRevisionIdN(
request: RequestWithUser,
system: string,