diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index ff6e3872..7e591da9 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -5461,6 +5461,50 @@ export class OrganizationController extends Controller { } } + /** + * API เช็ค node + * + * @summary เช็ค node (ADMIN) + * + */ + @Post("find/node-all") + async findNodeAllOrg(@Body() requestBody: { node: number; nodeId: string }) { + switch (requestBody.node) { + case 0: { + const data = await this.orgRootRepository.findOne({ + where: { id: requestBody.nodeId }, + }); + return new HttpSuccess(data); + } + case 1: { + const data = await this.child1Repository.findOne({ + where: { id: requestBody.nodeId }, + }); + return new HttpSuccess(data); + } + case 2: { + const data = await this.child2Repository.findOne({ + where: { id: requestBody.nodeId }, + }); + return new HttpSuccess(data); + } + case 3: { + const data = await this.child3Repository.findOne({ + where: { id: requestBody.nodeId }, + }); + return new HttpSuccess(data); + } + case 4: { + const data = await this.child4Repository.findOne({ + where: { id: requestBody.nodeId }, + }); + return new HttpSuccess(data); + } + default: + return new HttpSuccess([]); + } + } + /** * API เช็ค node detail *