From d823a448bc0c71fa8e972a7759d0d58fb7792ed9 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 17 Sep 2025 18:16:39 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=80?= =?UTF-8?q?=E0=B8=9B=E0=B9=87=E0=B8=99=20POST=20=E0=B9=81=E0=B8=97?= =?UTF-8?q?=E0=B8=99=20GET=20>>=20report=202=203=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 45 ++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 2c4be4c4..a5df992d 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -3469,8 +3469,16 @@ export class ReportController extends Controller { * @summary Report2 * */ - @Get("report2/{rootId}") - async findReport2(@Path() rootId: string) { + @Post("report2") + async NewReport2( + @Body() + reqBody: { + node: number; + nodeId: string; + } + ) { + // @Get("report2/{rootId}") + // async findReport2(@Path() rootId: string) { // const orgRevision = await this.orgRevisionRepository.findOne({ // where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false }, // relations: ["orgRoots"], @@ -3481,7 +3489,8 @@ export class ReportController extends Controller { // (async () => { const orgRootData = await this.orgRootRepository.find({ where: { - id: rootId, + id: reqBody.nodeId, + // id: rootId, // orgRevisionId: orgRevision.id, }, order: { orgRootOrder: "ASC" }, @@ -7822,8 +7831,16 @@ export class ReportController extends Controller { * @summary Report3 * */ - @Get("report3/{rootId}") - async findReport3(@Path() rootId: string) { + @Post("report3") + async NewReport3( + @Body() + reqBody: { + node: number; + nodeId: string; + } + ) { + // @Get("report3/{rootId}") + // async findReport3(@Path() rootId: string) { // const orgRevision = await this.orgRevisionRepository.findOne({ // where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false }, // relations: ["orgRoots"], @@ -7834,7 +7851,7 @@ export class ReportController extends Controller { const orgRootData = await this.orgRootRepository.find({ where: { - id: rootId, + id: reqBody.nodeId, // orgRevisionId: orgRevision.id, }, order: { orgRootOrder: "ASC" }, @@ -9063,13 +9080,21 @@ export class ReportController extends Controller { }); } - @Get("report4/{rootId}") - async findReport4(@Path() rootId: string) { + @Post("report4") + async NewReport4( + @Body() + reqBody: { + node: number; + nodeId: string; + } + ) { + // @Get("report4/{rootId}") + // async findReport4(@Path() rootId: string) { const orgRootData = await this.orgRootRepository.findOne({ - where: { id: rootId }, + where: { id: reqBody.nodeId }, }); if (!orgRootData) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - + let rootId:string = reqBody.nodeId; const posMaster = await this.posMasterRepository .createQueryBuilder("posMaster") .leftJoinAndSelect("posMaster.positions", "position")