comment workflow

This commit is contained in:
kittapath 2024-10-18 11:33:04 +07:00
parent 3fc5a73947
commit 6a23f31046
36 changed files with 32 additions and 177 deletions

View file

@ -17,11 +17,10 @@ import HttpError from "../interfaces/http-error";
import HttpStatus from "../interfaces/http-status";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import { AuthRole, CreateAuthRole, UpdateAuthRole, CreateAddAuthRole } from "../entities/AuthRole";
import { AuthRole, CreateAuthRole, CreateAddAuthRole } from "../entities/AuthRole";
import { AuthRoleAttr } from "../entities/AuthRoleAttr";
import { PosMaster } from "../entities/PosMaster";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { promisify } from "util";
import { setLogDataDiff } from "../interfaces/utils";
const REDIS_HOST = process.env.REDIS_HOST;
@ -105,7 +104,7 @@ export class AuthRoleController extends Controller {
posMaster.lastUpdateFullName = req.user.name;
posMaster.lastUpdatedAt = new Date();
posMaster.authRoleId = body.authRoleId;
await this.posMasterRepository.save(posMaster, {data: req});
await this.posMasterRepository.save(posMaster, { data: req });
setLogDataDiff(req, { before, after: posMaster });
// เช็คว่าถ้ามีค่า current_holderId ให้ลบ key สิทธิ์ใน redis
@ -149,7 +148,7 @@ export class AuthRoleController extends Controller {
posMaster.lastUpdateFullName = req.user.name;
posMaster.lastUpdatedAt = new Date();
posMaster.authRoleId = body.authRoleId;
await this.employeePosMasterRepository.save(posMaster, {data: req});
await this.employeePosMasterRepository.save(posMaster, { data: req });
setLogDataDiff(req, { before, after: posMaster });
return new HttpSuccess();
}
@ -229,7 +228,7 @@ export class AuthRoleController extends Controller {
// ...newAttrs.map((attr) => this.authRoleAttrRepo.save(attr)),
// ]);
await this.authRoleAttrRepo.remove(roleAttrData, {data: req});
await this.authRoleAttrRepo.remove(roleAttrData, { data: req });
const newAttrs = body.authRoleAttrs.map((attr) => {
const newAttr = new AuthRoleAttr();
@ -246,7 +245,7 @@ export class AuthRoleController extends Controller {
});
const before = structuredClone(record);
await Promise.all([
this.authRoleRepo.save(record, {data: req}),
this.authRoleRepo.save(record, { data: req }),
setLogDataDiff(req, { before, after: record }),
...newAttrs.map((attr) => this.authRoleAttrRepo.save(attr)),
]);
@ -271,7 +270,7 @@ export class AuthRoleController extends Controller {
if (!result) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
await this.authRoleRepo.remove(result, {data: req});
await this.authRoleRepo.remove(result, { data: req });
} catch {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบข้อมูลได้");
}

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
} from "tsoa";

View file

@ -10,7 +10,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Query,
} from "tsoa";

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
Query,
@ -19,7 +18,7 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { Command } from "../entities/Command";
import { Brackets, LessThan, MoreThan, Double, In, Not, Between } from "typeorm";
import { Brackets, LessThan, MoreThan, Double, In, Between } from "typeorm";
import { CommandType } from "../entities/CommandType";
import { CommandSend } from "../entities/CommandSend";
import { Profile, CreateProfileAllFields } from "../entities/Profile";

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
Query,
@ -19,7 +18,6 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { CommandSalary, CreateCommandSalary, UpdateCommandSalary } from "../entities/CommandSalary";
import { Not } from "typeorm";
import { CommandSys } from "../entities/CommandSys";
@Route("api/v1/org/commandSalary")

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
} from "tsoa";

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
Query,
@ -19,7 +18,6 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { CommandType, CreateCommandType, UpdateCommandType } from "../entities/CommandType";
import { Not } from "typeorm";
import { CommandSys } from "../entities/CommandSys";
@Route("api/v1/org/commandType")

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
} from "tsoa";

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
} from "tsoa";

View file

@ -10,7 +10,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
@ -34,7 +33,6 @@ import { EmployeePosDict } from "../entities/EmployeePosDict";
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
export class EmployeePosLevelController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
private employeePosLevelRepository = AppDataSource.getRepository(EmployeePosLevel);

View file

@ -10,7 +10,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
@ -36,9 +35,7 @@ import { setLogDataDiff } from "../interfaces/utils";
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
export class EmployeePosTypeController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
private employeePosLevelRepository = AppDataSource.getRepository(EmployeePosLevel);
/**
* API
*

View file

@ -10,7 +10,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Query,
} from "tsoa";
@ -38,9 +37,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
import { AuthRole } from "../entities/AuthRole";
import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission";
import { request } from "axios";
import { setLogDataDiff } from "../interfaces/utils";
import { after } from "node:test";
@Route("api/v1/org/employee/pos")
@Tags("Employee")
@Security("bearerAuth")

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
} from "tsoa";

View file

@ -1,23 +1,7 @@
import {
Controller,
Get,
Post,
Put,
Delete,
Route,
Security,
Tags,
Body,
Path,
Request,
Query,
UploadedFile,
} from "tsoa";
import { Controller, Post, Route, Security, Tags, Request, UploadedFile } from "tsoa";
import { AppDataSource } from "../database/data-source";
import { Brackets, Double, In, Not } from "typeorm";
import { In, Not } from "typeorm";
import HttpSuccess from "../interfaces/http-success";
import HttpError from "../interfaces/http-error";
import HttpStatusCode from "../interfaces/http-status";
import { UseInterceptors } from "@nestjs/common";
import { Profile } from "../entities/Profile";
import { ProfileEmployee } from "../entities/ProfileEmployee";
@ -31,16 +15,9 @@ import { PosType } from "../entities/PosType";
import { FileInterceptor } from "@nestjs/platform-express";
import * as xlsx from "xlsx";
import Extension from "../interfaces/extension";
import {
calculateAge,
calculateRetireDate,
calculateRetireLaw,
calculateRetireYear,
removeProfileInOrganize,
} from "../interfaces/utils";
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
import * as fs from "fs";
import * as path from "path";
import csv from "csv-parser"; // src/importCsv.ts
const { createConnection } = require("typeorm");
import csvParser from "csv-parser";
import { HR_POSITION_OFFICER } from "../entities/HR_POSITION_OFFICER";
@ -48,7 +25,6 @@ import { HR_PERSONAL_OFFICER_FAMILY } from "../entities/HR_PERSONAL_OFFICER_FAMI
const BATCH_SIZE = 1000;
// import { EducationMis } from "../entities/EducationMis";
import moment from "moment";
import { EducationMis } from "../entities/EducationMis";
import { ProvinceImport } from "../entities/ProvinceImport";
import { AmphurImport } from "../entities/AmphurImport";

View file

@ -4,24 +4,20 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
Body,
Path,
Request,
Example,
SuccessResponse,
Response,
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { Equal, ILike, In, IsNull, Like, Not, Brackets, Between } from "typeorm";
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
import { Not } from "typeorm";
import { InsigniaType } from "../entities/InsigniaType";
import { Insignia, CreateInsignias, UpdateInsignias } from "../entities/Insignia";
import permission from "../interfaces/permission";
import { RequestWithUser } from "../middlewares/user";

View file

@ -4,23 +4,19 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
Body,
Path,
Request,
Example,
SuccessResponse,
Response,
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { Equal, ILike, In, IsNull, Like, Not, Brackets, Between } from "typeorm";
import { Not } from "typeorm";
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
import { Insignia } from "../entities/Insignia";
import permission from "../interfaces/permission";

View file

@ -1,4 +1,4 @@
import { Controller, Get, Post, Put, Delete, Patch, Route, Security, Tags } from "tsoa";
import { Controller, Get, Route, Security, Tags } from "tsoa";
@Route("/hello")
@Tags("Test")

View file

@ -4,21 +4,7 @@ import { OrgRoot } from "../entities/OrgRoot";
import { OrgChild1, CreateOrgChild1, UpdateOrgChild1 } from "../entities/OrgChild1";
import { OrgChild2 } from "../entities/OrgChild2";
import { OrgChild3 } from "../entities/OrgChild3";
import {
Body,
Delete,
Get,
Path,
Post,
Put,
Response,
Route,
SuccessResponse,
Tags,
Query,
Request,
Security,
} from "tsoa";
import { Body, Delete, Get, Path, Post, Put, Response, Route, Tags, Request, Security } from "tsoa";
import HttpStatusCode from "../interfaces/http-status";
import HttpSuccess from "../interfaces/http-success";
import HttpError from "../interfaces/http-error";
@ -28,7 +14,6 @@ import { PosMaster } from "../entities/PosMaster";
import { Position } from "../entities/Position";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { EmployeePosition } from "../entities/EmployeePosition";
import { Like } from "typeorm/browser";
import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission";
import { setLogDataDiff } from "../interfaces/utils";

View file

@ -5,7 +5,6 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
@ -13,7 +12,6 @@ import {
Body,
Request,
Example,
SuccessResponse,
Response,
} from "tsoa";
import HttpStatusCode from "../interfaces/http-status";
@ -41,7 +39,6 @@ import { setLogDataDiff } from "../interfaces/utils";
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
export class OrgChild2Controller extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child1Repository = AppDataSource.getRepository(OrgChild1);
private child2Repository = AppDataSource.getRepository(OrgChild2);
private child3Repository = AppDataSource.getRepository(OrgChild3);

View file

@ -4,21 +4,7 @@ import { OrgRoot } from "../entities/OrgRoot";
import { OrgChild2 } from "../entities/OrgChild2";
import { OrgChild3, CreateOrgChild3, UpdateOrgChild3 } from "../entities/OrgChild3";
import { OrgChild4 } from "../entities/OrgChild4";
import {
Body,
Delete,
Get,
Path,
Post,
Put,
Response,
Route,
SuccessResponse,
Tags,
Query,
Request,
Security,
} from "tsoa";
import { Body, Delete, Get, Path, Post, Put, Response, Route, Tags, Request, Security } from "tsoa";
import HttpStatusCode from "../interfaces/http-status";
import HttpSuccess from "../interfaces/http-success";
import HttpError from "../interfaces/http-error";
@ -38,7 +24,6 @@ import { setLogDataDiff } from "../interfaces/utils";
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
export class OrgChild3Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child2Repository = AppDataSource.getRepository(OrgChild2);
private child3Repository = AppDataSource.getRepository(OrgChild3);
private child4Repository = AppDataSource.getRepository(OrgChild4);

View file

@ -5,7 +5,6 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
@ -13,7 +12,6 @@ import {
Body,
Request,
Example,
SuccessResponse,
Response,
} from "tsoa";
import HttpStatusCode from "../interfaces/http-status";
@ -23,7 +21,6 @@ import { In } from "typeorm";
import { OrgRevision } from "../entities/OrgRevision";
import { OrgRoot } from "../entities/OrgRoot";
import { CreateOrgChild4, OrgChild4, UpdateOrgChild4 } from "../entities/OrgChild4";
import { OrgChild1 } from "../entities/OrgChild1";
import { OrgChild3 } from "../entities/OrgChild3";
import { PosMaster } from "../entities/PosMaster";
import { Position } from "../entities/Position";
@ -41,7 +38,6 @@ import { setLogDataDiff } from "../interfaces/utils";
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
export class OrgChild4Controller extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child3Repository = AppDataSource.getRepository(OrgChild3);
private child4Repository = AppDataSource.getRepository(OrgChild4);
private posMasterRepository = AppDataSource.getRepository(PosMaster);

View file

@ -4,7 +4,6 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
@ -16,8 +15,8 @@ import {
import { CreateOrgRoot, OrgRoot } from "../entities/OrgRoot";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import { CreateOrgChild1, OrgChild1 } from "../entities/OrgChild1";
import { In, IsNull, Not } from "typeorm";
import { OrgChild1 } from "../entities/OrgChild1";
import { In, Not } from "typeorm";
import HttpError from "../interfaces/http-error";
import HttpStatusCode from "../interfaces/http-status";
import { OrgRevision } from "../entities/OrgRevision";

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
} from "tsoa";
import { CreateOrgRevision, OrgRevision } from "../entities/OrgRevision";
@ -25,13 +24,11 @@ import { OrgChild3 } from "../entities/OrgChild3";
import { OrgChild4 } from "../entities/OrgChild4";
import { PosMaster } from "../entities/PosMaster";
import { Position } from "../entities/Position";
import CallAPI from "../interfaces/call-api";
import { ProfileSalary } from "../entities/ProfileSalary";
import { Profile } from "../entities/Profile";
import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission";
import { PermissionOrg } from "../entities/PermissionOrg";
import FunctionMain from "../interfaces/functionMain";
import { setLogDataDiff } from "../interfaces/utils";
import { AuthRole } from "../entities/AuthRole";
@ -52,9 +49,7 @@ export class OrganizationController extends Controller {
private child4Repository = AppDataSource.getRepository(OrgChild4);
private posMasterRepository = AppDataSource.getRepository(PosMaster);
private positionRepository = AppDataSource.getRepository(Position);
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
private profileRepo = AppDataSource.getRepository(Profile);
private authRoleRepo = AppDataSource.getRepository(AuthRole);
/**
* API

View file

@ -2,7 +2,6 @@ import {
Controller,
Post,
Put,
Delete,
Route,
Security,
Tags,
@ -12,8 +11,6 @@ import {
SuccessResponse,
Response,
Get,
Query,
Example,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
@ -21,13 +18,12 @@ import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { Brackets, IsNull, Like, Not } from "typeorm";
import { Brackets, IsNull, Not } from "typeorm";
import { OrgRevision } from "../entities/OrgRevision";
import { OrgRoot } from "../entities/OrgRoot";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { Position } from "../entities/Position";
import { CreateInsignias, Insignia } from "../entities/Insignia";
import { InsigniaType } from "../entities/InsigniaType";
import { Insignia } from "../entities/Insignia";
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
@Route("api/v1/org/dotnet")
@ -44,7 +40,6 @@ export class OrganizationDotnetController extends Controller {
private profileRepo = AppDataSource.getRepository(Profile);
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
private positionRepository = AppDataSource.getRepository(Position);
private insigniaMetaRepo = AppDataSource.getRepository(Insignia);
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
/**

View file

@ -1,4 +1,4 @@
import { Controller, Get, Post, Route, Tags, Body, Path, SuccessResponse, Response } from "tsoa";
import { Controller, Get, Post, Route, Tags, Body, Path, Response } from "tsoa";
import { OrgRevision } from "../entities/OrgRevision";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
@ -21,8 +21,6 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
export class OrganizationUnauthorizeController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private profileRepository = AppDataSource.getRepository(Profile);
private profileEmployeeRepository = AppDataSource.getRepository(ProfileEmployee);
/**
* API (unauthorize)

View file

@ -1,4 +1,4 @@
import { Body, Controller, Get, Path, Post, Request, Route, Security, Tags } from "tsoa";
import { Controller, Get, Path, Request, Route, Security, Tags } from "tsoa";
import { AppDataSource } from "../database/data-source";
import { RequestWithUser } from "../middlewares/user";
import HttpError from "../interfaces/http-error";

View file

@ -1,7 +1,6 @@
import {
Controller,
Post,
Put,
Delete,
Route,
Security,
@ -9,7 +8,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
Query,
@ -18,17 +16,13 @@ import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { Not } from "typeorm";
import { OrgRoot } from "../entities/OrgRoot";
import { OrgRevision } from "../entities/OrgRevision";
import { RequestWithUser } from "../middlewares/user";
import { PermissionOrg } from "../entities/PermissionOrg";
import { Profile } from "../entities/Profile";
import HttpStatus from "../interfaces/http-status";
import permission from "../interfaces/permission";
import { PosMaster } from "../entities/PosMaster";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { setLogDataDiff } from "../interfaces/utils";
@Route("api/v1/org/permission-org")
@ -44,9 +38,7 @@ export class PermissionOrgController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg);
private posMasterRepository = AppDataSource.getRepository(PosMaster);
private posMasterEmpRepository = AppDataSource.getRepository(EmployeePosMaster);
private profileRepo = AppDataSource.getRepository(Profile);
private profileEmployeeRepo = AppDataSource.getRepository(ProfileEmployee);
/**
* API

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
Example,
@ -22,7 +21,6 @@ import HttpError from "../interfaces/http-error";
import { CreatePosExecutive, PosExecutive } from "../entities/PosExecutive";
import { Position } from "../entities/Position";
import { RequestWithUser } from "../middlewares/user";
import { after } from "node:test";
import { setLogDataDiff } from "../interfaces/utils";
@Route("api/v1/org/pos/executive")
@Tags("PosExecutive")

View file

@ -4,7 +4,6 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
@ -12,9 +11,7 @@ import {
Path,
Request,
Example,
SuccessResponse,
Response,
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";

View file

@ -9,13 +9,11 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import { PosLevel, CreatePosLevel } from "../entities/PosLevel";
import HttpError from "../interfaces/http-error";
import { PosMasterAct } from "../entities/PosMasterAct";
import { PosMaster } from "../entities/PosMaster";

View file

@ -4,7 +4,6 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
@ -12,9 +11,7 @@ import {
Path,
Request,
Example,
SuccessResponse,
Response,
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
@ -35,7 +32,6 @@ import { RequestWithUser } from "../middlewares/user";
)
export class PosTypeController extends Controller {
private posTypeRepository = AppDataSource.getRepository(PosType);
private posLevelRepository = AppDataSource.getRepository(PosLevel);
/**
* API

View file

@ -4,7 +4,6 @@ import {
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
@ -12,7 +11,6 @@ import {
Path,
Request,
Example,
SuccessResponse,
Response,
Query,
} from "tsoa";
@ -24,7 +22,7 @@ import { PosType } from "../entities/PosType";
import { PosLevel } from "../entities/PosLevel";
import { CreatePosDict, CreatePosDictExe, PosDict, UpdatePosDict } from "../entities/PosDict";
import HttpError from "../interfaces/http-error";
import { Equal, ILike, In, IsNull, Like, Not, Brackets, MoreThan } from "typeorm";
import { In, IsNull, Like, Not, Brackets } from "typeorm";
import { CreatePosMaster, PosMaster } from "../entities/PosMaster";
import { OrgRevision } from "../entities/OrgRevision";
import { OrgRoot } from "../entities/OrgRoot";
@ -40,10 +38,8 @@ import { EmployeePosLevel } from "../entities/EmployeePosLevel";
import { AuthRole } from "../entities/AuthRole";
import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission";
import { request } from "axios";
import { setLogDataDiff } from "../interfaces/utils";
import { PosMasterAssign } from "../entities/PosMasterAssign";
import { CommandSys } from "../entities/CommandSys";
import { Assign } from "../entities/Assign";
@Route("api/v1/org/pos")
@Tags("Position")
@ -4151,6 +4147,7 @@ export class PositionController extends Controller {
positionName: position?.positionName || null,
posType: position?.posType?.posTypeName || null,
posLevel: position?.posLevel?.posLevelName || null,
profileId: x.next_holder?.id || null,
prefix: x.next_holder?.prefix || null,
firstName: x.next_holder?.firstName || null,
lastName: x.next_holder?.lastName || null,

View file

@ -9,7 +9,6 @@ import {
Body,
Path,
Request,
SuccessResponse,
Response,
Get,
} from "tsoa";
@ -21,7 +20,6 @@ import { Prefixe, CreatePrefixe, UpdatePrefixe } from "../entities/Prefixe";
import { Not } from "typeorm";
import { setLogDataDiff } from "../interfaces/utils";
import { RequestWithUser } from "../middlewares/user";
import { request } from "axios";
@Route("api/v1/org/metadata/prefix")
@Tags("Prefix")

View file

@ -546,34 +546,23 @@ export class WorkflowController extends Controller {
@Request() req: RequestWithUser,
@Body()
body: {
stateId: string;
stateUserCommentId: string;
isAccept?: boolean | null;
isApprove?: boolean | null;
reason?: string | null;
},
) {
const profile = await this.profileRepo.findOne({
const stateUserComment = await this.stateUserCommentRepo.findOne({
where: {
keycloak: req.user.sub,
id: body.stateUserCommentId,
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
const state = await this.stateRepo.findOne({
where: {
id: body.stateId,
},
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
if (!stateUserComment)
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
let _null: any = null;
const stateUserComment = new StateUserComment();
stateUserComment.stateId = body.stateId;
stateUserComment.profileId = profile.id;
stateUserComment.isAccept = body.isAccept == null ? _null : body.isAccept;
stateUserComment.isApprove = body.isApprove == null ? _null : body.isAccept;
stateUserComment.reason = body.reason == null ? _null : body.isAccept;
stateUserComment.createdUserId = req.user.sub;
stateUserComment.createdFullName = req.user.name;
stateUserComment.createdAt = new Date();
stateUserComment.lastUpdateUserId = req.user.sub;
stateUserComment.lastUpdateFullName = req.user.name;
stateUserComment.lastUpdatedAt = new Date();
@ -620,6 +609,7 @@ export class WorkflowController extends Controller {
});
return new HttpSuccess({
id: stateUserComment?.id || null,
isAccept: stateUserComment?.isAccept || null,
isApprove: stateUserComment?.isApprove || null,
reason: stateUserComment?.reason || null,

View file

@ -1,11 +1,9 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosType } from "./PosType";
import { Position } from "./Position";
import { PosDict } from "./PosDict";
import { Profile } from "./Profile";
import { profile } from "console";
import { Workflow } from "./Workflow";
enum PosLevelAuthority {
HEAD = "HEAD",
@ -57,9 +55,6 @@ export class PosLevel extends EntityBase {
@OneToMany(() => Profile, (profile) => profile.posLevel)
profiles: Profile[];
// @OneToMany(() => Workflow, (workflow) => workflow.posLevel)
// workflows: Workflow[];
}
export class CreatePosLevel {

View file

@ -1,10 +1,9 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosLevel } from "./PosLevel";
import { Position } from "./Position";
import { PosDict } from "./PosDict";
import { Profile } from "./Profile";
import { Workflow } from "./Workflow";
@Entity("posType")
export class PosType extends EntityBase {
@ -35,9 +34,6 @@ export class PosType extends EntityBase {
@OneToMany(() => Profile, (profile) => profile.posType)
profiles: Profile[];
// @OneToMany(() => Workflow, (workflow) => workflow.posType)
// workflows: Workflow[];
}
export class CreatePosType {