no message

This commit is contained in:
Bright 2025-02-19 16:36:47 +07:00
parent 6d4992b801
commit 22c9027964

View file

@ -1,4 +1,4 @@
import { Body, Controller, Get, Path, Post, Put, Request, Route, Security, Tags } from "tsoa";
import { Body, Controller, Get, Path, Post, Put, Request, Route, Security, Tags, } from "tsoa";
import { AppDataSource } from "../database/data-source";
import { RequestWithUser } from "../middlewares/user";
import HttpError from "../interfaces/http-error";
@ -15,7 +15,7 @@ import { MetaWorkflow } from "../entities/MetaWorkflow";
import { MetaState } from "../entities/MetaState";
import { MetaStateOperator } from "../entities/MetaStateOperator";
import { PosMaster } from "../entities/PosMaster";
import { Brackets, IsNull, Not } from "typeorm";
import { Brackets, IsNull, Not, In } from "typeorm";
import { Assign } from "../entities/Assign";
import { PosMasterAct } from "../entities/PosMasterAct";
import { viewDirectorActing } from "../entities/view/viewDirectorActing";
@ -1143,4 +1143,48 @@ export class WorkflowController extends Controller {
if (!profileOfficer) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
return new HttpSuccess();
}
/**
* API
*
* @summary
*
*/
@Post("find/director")
async getProfileDirectorByProfileId(@Request() req: RequestWithUser,
@Body()
body: {
system: string;
refId: string[];
},) {
const _posMaster = await this.posMasterRepo.find({
where: {
posMasterAssigns: { assignId: body.system },
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
current_holderId: In(body.refId),
},
select:["orgRootId","orgChild1Id","orgChild2Id","orgChild3Id","orgChild4Id"]
});
const _data:any = _posMaster.map((x) => ({
orgRootId: x.orgRootId,
orgChild1Id: x.orgChild1Id,
orgChild2Id: x.orgChild2Id,
orgChild3Id: x.orgChild3Id,
orgChild4Id: x.orgChild4Id,
director: true,
}));
const posMaster = await this.posMasterRepo.find({
where: _data,
relations:["current_holder"]
});
const data = posMaster.map((x) => ({
id: x.current_holder.id,
citizenId: x.current_holder.citizenId,
prefix: x.current_holder.prefix,
firstName: x.current_holder.firstName,
lastName: x.current_holder.lastName,
}));
return new HttpSuccess(data);
}
}