From c937b961195f305fd5f4b93540301ef0827eea65 Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 10 Jan 2025 17:54:07 +0700 Subject: [PATCH] no message --- src/controllers/OrganizationController.ts | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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 *