แก้บัญชี1 2 3

This commit is contained in:
kittapath 2024-09-17 09:51:23 +07:00
parent 471307cf3f
commit 2a73c9d440
2 changed files with 34 additions and 33 deletions

View file

@ -255,7 +255,6 @@ export class CommandTypeController extends Controller {
_commandType.lastUpdateUserId = request.user.sub;
_commandType.lastUpdateFullName = request.user.name;
_commandType.lastUpdatedAt = new Date();
this.commandTypeRepository.merge(_commandType, requestBody);
await this.commandTypeRepository.save(_commandType);
return new HttpSuccess(_commandType.id);
}
@ -282,7 +281,6 @@ export class CommandTypeController extends Controller {
_commandType.lastUpdateUserId = request.user.sub;
_commandType.lastUpdateFullName = request.user.name;
_commandType.lastUpdatedAt = new Date();
this.commandTypeRepository.merge(_commandType, requestBody);
await this.commandTypeRepository.save(_commandType);
return new HttpSuccess(_commandType.id);
}

View file

@ -1,4 +1,4 @@
import { Controller, Get, Route, Security, Tags, SuccessResponse, Response } from "tsoa";
import { Controller, Get, Route, Security, Tags, SuccessResponse, Response, Path } from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
@ -33,19 +33,20 @@ export class ReportController extends Controller {
* @summary Report1
*
*/
@Get("report1")
async findReport1() {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
relations: ["orgRoots"],
});
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
@Get("report1/{rootId}")
async findReport1(@Path() rootId: string) {
// const orgRevision = await this.orgRevisionRepository.findOne({
// where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
// relations: ["orgRoots"],
// });
// if (!orgRevision) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
// }
const orgRootData = await this.orgRootRepository.find({
where: {
orgRevisionId: orgRevision.id,
id: rootId,
// orgRevisionId: orgRevision.id,
},
order: { orgRootOrder: "ASC" },
relations: [
@ -681,19 +682,20 @@ export class ReportController extends Controller {
* @summary Report2
*
*/
@Get("report2")
async findReport2() {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
relations: ["orgRoots"],
});
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
@Get("report2/{rootId}")
async findReport2(@Path() rootId: string) {
// const orgRevision = await this.orgRevisionRepository.findOne({
// where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
// relations: ["orgRoots"],
// });
// if (!orgRevision) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
// }
const orgRootData = await this.orgRootRepository.find({
where: {
orgRevisionId: orgRevision.id,
id: rootId,
// orgRevisionId: orgRevision.id,
},
order: { orgRootOrder: "ASC" },
relations: [
@ -2848,19 +2850,20 @@ export class ReportController extends Controller {
* @summary Report3
*
*/
@Get("report3")
async findReport3() {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
relations: ["orgRoots"],
});
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
@Get("report3/{rootId}")
async findReport3(@Path() rootId: string) {
// const orgRevision = await this.orgRevisionRepository.findOne({
// where: { orgRevisionIsDraft: true, orgRevisionIsCurrent: false },
// relations: ["orgRoots"],
// });
// if (!orgRevision) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
// }
const orgRootData = await this.orgRootRepository.find({
where: {
orgRevisionId: orgRevision.id,
id: rootId,
// orgRevisionId: orgRevision.id,
},
order: { orgRootOrder: "ASC" },
relations: [