ปรับเป็น POST แทน GET >> report 2 3 4

This commit is contained in:
Bright 2025-09-17 18:16:39 +07:00
parent aa2831307b
commit d823a448bc

View file

@ -3469,8 +3469,16 @@ export class ReportController extends Controller {
* @summary Report2 * @summary Report2
* *
*/ */
@Get("report2/{rootId}") @Post("report2")
async findReport2(@Path() rootId: string) { async NewReport2(
@Body()
reqBody: {
node: number;
nodeId: string;
}
) {
// @Get("report2/{rootId}")
// async findReport2(@Path() rootId: string) {
// const orgRevision = await this.orgRevisionRepository.findOne({ // const orgRevision = await this.orgRevisionRepository.findOne({
// where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false }, // where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
// relations: ["orgRoots"], // relations: ["orgRoots"],
@ -3481,7 +3489,8 @@ export class ReportController extends Controller {
// (async () => { // (async () => {
const orgRootData = await this.orgRootRepository.find({ const orgRootData = await this.orgRootRepository.find({
where: { where: {
id: rootId, id: reqBody.nodeId,
// id: rootId,
// orgRevisionId: orgRevision.id, // orgRevisionId: orgRevision.id,
}, },
order: { orgRootOrder: "ASC" }, order: { orgRootOrder: "ASC" },
@ -7822,8 +7831,16 @@ export class ReportController extends Controller {
* @summary Report3 * @summary Report3
* *
*/ */
@Get("report3/{rootId}") @Post("report3")
async findReport3(@Path() rootId: string) { async NewReport3(
@Body()
reqBody: {
node: number;
nodeId: string;
}
) {
// @Get("report3/{rootId}")
// async findReport3(@Path() rootId: string) {
// const orgRevision = await this.orgRevisionRepository.findOne({ // const orgRevision = await this.orgRevisionRepository.findOne({
// where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false }, // where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
// relations: ["orgRoots"], // relations: ["orgRoots"],
@ -7834,7 +7851,7 @@ export class ReportController extends Controller {
const orgRootData = await this.orgRootRepository.find({ const orgRootData = await this.orgRootRepository.find({
where: { where: {
id: rootId, id: reqBody.nodeId,
// orgRevisionId: orgRevision.id, // orgRevisionId: orgRevision.id,
}, },
order: { orgRootOrder: "ASC" }, order: { orgRootOrder: "ASC" },
@ -9063,13 +9080,21 @@ export class ReportController extends Controller {
}); });
} }
@Get("report4/{rootId}") @Post("report4")
async findReport4(@Path() rootId: string) { async NewReport4(
@Body()
reqBody: {
node: number;
nodeId: string;
}
) {
// @Get("report4/{rootId}")
// async findReport4(@Path() rootId: string) {
const orgRootData = await this.orgRootRepository.findOne({ const orgRootData = await this.orgRootRepository.findOne({
where: { id: rootId }, where: { id: reqBody.nodeId },
}); });
if (!orgRootData) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); if (!orgRootData) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
let rootId:string = reqBody.nodeId;
const posMaster = await this.posMasterRepository const posMaster = await this.posMasterRepository
.createQueryBuilder("posMaster") .createQueryBuilder("posMaster")
.leftJoinAndSelect("posMaster.positions", "position") .leftJoinAndSelect("posMaster.positions", "position")