This commit is contained in:
parent
7d572b18d2
commit
f31ecf1c2b
11 changed files with 349 additions and 19 deletions
|
|
@ -12,7 +12,7 @@ import {
|
|||
Request,
|
||||
Example,
|
||||
} from "tsoa";
|
||||
import { CreateOrgRoot, OrgRoot } from "../entities/OrgRoot";
|
||||
import { CreateOrgRoot, OrgRoot, UpdateOrgRoot } from "../entities/OrgRoot";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import { OrgChild1 } from "../entities/OrgChild1";
|
||||
|
|
@ -226,7 +226,7 @@ export class OrgRootController extends Controller {
|
|||
async update(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: CreateOrgRoot,
|
||||
requestBody: UpdateOrgRoot,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
|
|
@ -332,11 +332,18 @@ export class OrgRootController extends Controller {
|
|||
// if(chkShortChild1 != null){
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "อักษรย่อนี้ซ้ำกับอักษรย่อส่วนราชการ");
|
||||
// }
|
||||
const _null:any = null;
|
||||
const before = structuredClone(orgRoot);
|
||||
orgRoot.lastUpdateUserId = request.user.sub;
|
||||
orgRoot.lastUpdateFullName = request.user.name;
|
||||
orgRoot.lastUpdatedAt = new Date();
|
||||
this.orgRootRepository.merge(orgRoot, requestBody);
|
||||
this.orgRootRepository.merge(orgRoot, {
|
||||
...requestBody,
|
||||
DEPARTMENT_CODE: requestBody.DEPARTMENT_CODE != null ? requestBody.DEPARTMENT_CODE : _null,
|
||||
DIVISION_CODE: requestBody.DIVISION_CODE != null ? requestBody.DIVISION_CODE : _null,
|
||||
SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null,
|
||||
JOB_CODE: requestBody.JOB_CODE != null ? requestBody.JOB_CODE : _null,
|
||||
});
|
||||
await this.orgRootRepository.save(orgRoot, { data: request });
|
||||
setLogDataDiff(request, { before, after: orgRoot });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue