Merge branch 'develop' into adiDev
This commit is contained in:
commit
e5b1c3b8d5
113 changed files with 455 additions and 505 deletions
|
|
@ -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, "ไม่สามารถลบข้อมูลได้");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -28,7 +27,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class BloodGroupController extends Controller {
|
||||
private bloodGroupRepository = AppDataSource.getRepository(BloodGroup);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
} from "tsoa";
|
||||
|
|
@ -44,7 +43,6 @@ import CallAPI from "../interfaces/call-api";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class ChangePositionController extends Controller {
|
||||
private changePositionRepository = AppDataSource.getRepository(ChangePosition);
|
||||
private profileChangePositionRepository = AppDataSource.getRepository(ProfileChangePosition);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -64,7 +63,6 @@ import permission from "../interfaces/permission";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class CommandController extends Controller {
|
||||
private commandRepository = AppDataSource.getRepository(Command);
|
||||
private commandTypeRepository = AppDataSource.getRepository(CommandType);
|
||||
|
|
@ -2747,6 +2745,62 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
await Promise.all(
|
||||
body.refIds.map(async (item) => {
|
||||
const profile = await this.profileEmployeeRepository.findOne({
|
||||
where: { id: item.refId },
|
||||
relations: ["posType", "posLevel"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
where: { profileEmployeeId: item.refId },
|
||||
order: { order: "DESC" },
|
||||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
const meta = {
|
||||
profileId: profile.id,
|
||||
date: new Date(),
|
||||
amount: item.amount,
|
||||
positionSalaryAmount: item.positionSalaryAmount,
|
||||
mouthSalaryAmount: item.mouthSalaryAmount,
|
||||
posNo: "",
|
||||
position: profile.position,
|
||||
positionType: profile.posType?.posTypeName || null,
|
||||
positionLevel: profile.posLevel?.posLevelName || null,
|
||||
refCommandNo: `${item.commandNo}/${Extension.ToThaiYear(item.commandYear)}`,
|
||||
templateDoc: item.templateDoc,
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
||||
Object.assign(data, meta);
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
||||
await this.salaryRepo.save(data, { data: req });
|
||||
setLogDataDiff(req, { before, after: data });
|
||||
history.profileSalaryId = data.id;
|
||||
await this.salaryHistoryRepo.save(history, { data: req });
|
||||
}),
|
||||
);
|
||||
const posMasters = await this.posMasterRepository.find({
|
||||
where: { id: In(body.refIds.map((x) => x.refId)) },
|
||||
});
|
||||
const data = posMasters.map((_data) => ({
|
||||
..._data,
|
||||
statusReport: "PENDING",
|
||||
}));
|
||||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
@Post("command38/officer/report")
|
||||
|
|
@ -2757,6 +2811,37 @@ export class CommandController extends Controller {
|
|||
refIds: string[];
|
||||
},
|
||||
) {
|
||||
const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds) } });
|
||||
const data = posMasters.map((_data) => ({
|
||||
..._data,
|
||||
statusReport: "REPORT",
|
||||
}));
|
||||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
@Post("command38/officer/report/delete")
|
||||
public async command38SalaryOfficerDelete(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
refIds: {
|
||||
refId: string;
|
||||
commandAffectDate: Date | null;
|
||||
commandNo: string | null;
|
||||
commandYear: number;
|
||||
templateDoc: string | null;
|
||||
amount: Double | null;
|
||||
positionSalaryAmount: Double | null;
|
||||
mouthSalaryAmount: Double | null;
|
||||
}[];
|
||||
},
|
||||
) {
|
||||
const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds) } });
|
||||
const data = posMasters.map((_data) => ({
|
||||
..._data,
|
||||
statusReport: "PENDING",
|
||||
}));
|
||||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -29,7 +27,6 @@ import { CommandSys } from "../entities/CommandSys";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class CommandSalaryController extends Controller {
|
||||
private commandSalaryRepository = AppDataSource.getRepository(CommandSalary);
|
||||
private commandSysRepository = AppDataSource.getRepository(CommandSys);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -26,7 +25,6 @@ import { CommandSys, CreateCommandSys, UpdateCommandSys } from "../entities/Comm
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class CommandSysController extends Controller {
|
||||
private commandSysRepository = AppDataSource.getRepository(CommandSys);
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -29,7 +27,6 @@ import { CommandSys } from "../entities/CommandSys";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class CommandTypeController extends Controller {
|
||||
private commandTypeRepository = AppDataSource.getRepository(CommandType);
|
||||
private commandSysRepository = AppDataSource.getRepository(CommandSys);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -30,7 +29,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class DistrictController extends Controller {
|
||||
private districtRepository = AppDataSource.getRepository(District);
|
||||
private provinceRepository = AppDataSource.getRepository(Province);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -28,7 +27,6 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class EducationLevelController extends Controller {
|
||||
private educationLevelRepository = AppDataSource.getRepository(EducationLevel);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
|
|
@ -33,9 +32,7 @@ import { EmployeePosDict } from "../entities/EmployeePosDict";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class EmployeePosLevelController extends Controller {
|
||||
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
||||
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
|
||||
private employeePosLevelRepository = AppDataSource.getRepository(EmployeePosLevel);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
|
|
@ -35,11 +34,8 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class EmployeePosTypeController extends Controller {
|
||||
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
||||
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
|
||||
private employeePosLevelRepository = AppDataSource.getRepository(EmployeePosLevel);
|
||||
/**
|
||||
* API เพิ่มกลุ่มงานลูกจ้างประจำ
|
||||
*
|
||||
|
|
@ -81,8 +77,8 @@ export class EmployeePosTypeController extends Controller {
|
|||
EmpPosType.lastUpdateFullName = request.user.name;
|
||||
EmpPosType.createdAt = new Date();
|
||||
EmpPosType.lastUpdatedAt = new Date();
|
||||
await this.employeePosTypeRepository.save(EmpPosType, {data: request});
|
||||
setLogDataDiff(request, {before, after: EmpPosType});
|
||||
await this.employeePosTypeRepository.save(EmpPosType, { data: request });
|
||||
setLogDataDiff(request, { before, after: EmpPosType });
|
||||
return new HttpSuccess(EmpPosType.id);
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +125,8 @@ export class EmployeePosTypeController extends Controller {
|
|||
EmpPosType.lastUpdateFullName = request.user.name;
|
||||
EmpPosType.lastUpdatedAt = new Date();
|
||||
this.employeePosTypeRepository.merge(EmpPosType, requestBody);
|
||||
await this.employeePosTypeRepository.save(EmpPosType, {data: request});
|
||||
setLogDataDiff(request, {before, after: EmpPosType});
|
||||
await this.employeePosTypeRepository.save(EmpPosType, { data: request });
|
||||
setLogDataDiff(request, { before, after: EmpPosType });
|
||||
return new HttpSuccess(EmpPosType.id);
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +143,8 @@ export class EmployeePosTypeController extends Controller {
|
|||
try {
|
||||
result = await this.employeePosTypeRepository.findOne({
|
||||
where: { id: id },
|
||||
})
|
||||
await this.employeePosTypeRepository.remove(result, {data: request});
|
||||
});
|
||||
await this.employeePosTypeRepository.remove(result, { data: request });
|
||||
} catch {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -48,7 +45,6 @@ import { after } from "node:test";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class EmployeePositionController extends Controller {
|
||||
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
||||
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
|
||||
|
|
@ -169,8 +165,8 @@ export class EmployeePositionController extends Controller {
|
|||
empPosDict.lastUpdateFullName = request.user.name;
|
||||
empPosDict.lastUpdatedAt = new Date();
|
||||
this.employeePosDictRepository.merge(empPosDict, requestBody);
|
||||
await this.employeePosDictRepository.save(empPosDict,{data: request});
|
||||
setLogDataDiff( request, { before, after: empPosDict });
|
||||
await this.employeePosDictRepository.save(empPosDict, { data: request });
|
||||
setLogDataDiff(request, { before, after: empPosDict });
|
||||
return new HttpSuccess(empPosDict.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -29,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class GenderController extends Controller {
|
||||
private genderRepository = AppDataSource.getRepository(Gender);
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -32,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class InsigniaController extends Controller {
|
||||
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
|
||||
private insigniaRepository = AppDataSource.getRepository(Insignia);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -33,7 +29,6 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class InsigniaTypeController extends Controller {
|
||||
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
|
||||
private insigniaRepository = AppDataSource.getRepository(Insignia);
|
||||
|
|
@ -110,7 +105,7 @@ export class InsigniaTypeController extends Controller {
|
|||
insigniaType.lastUpdatedAt = new Date();
|
||||
this.insigniaTypeRepository.merge(insigniaType, requestBody);
|
||||
await this.insigniaTypeRepository.save(insigniaType, { data: request });
|
||||
setLogDataDiff( request, { before, after: insigniaType });
|
||||
setLogDataDiff(request, { before, after: insigniaType });
|
||||
return new HttpSuccess(insigniaType.id);
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +131,7 @@ export class InsigniaTypeController extends Controller {
|
|||
"ไม่สามารถลบได้ เนื่องจากพบข้อมูลที่ตารางเครื่องราชอิสริยาภรณ์",
|
||||
);
|
||||
}
|
||||
await this.insigniaTypeRepository.remove(delInsigniaType, {data: request});
|
||||
await this.insigniaTypeRepository.remove(delInsigniaType, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -39,7 +24,6 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class OrgChild1Controller {
|
||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||
private child1Repository = AppDataSource.getRepository(OrgChild1);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -40,9 +38,7 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -37,9 +23,7 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class OrgChild3Controller {
|
||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||
private child2Repository = AppDataSource.getRepository(OrgChild2);
|
||||
private child3Repository = AppDataSource.getRepository(OrgChild3);
|
||||
private child4Repository = AppDataSource.getRepository(OrgChild4);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -40,9 +37,7 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
@ -42,7 +39,6 @@ import { AuthRole } from "../entities/AuthRole";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class OrganizationController extends Controller {
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg);
|
||||
|
|
@ -53,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 รายการประวัติโครงสร้าง
|
||||
|
|
@ -655,7 +649,7 @@ export class OrganizationController extends Controller {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const _orgRevisions = await this.orgRevisionRepository.find({
|
||||
where: [{ orgRevisionIsDraft: true, id: Not(revision.id) }],
|
||||
});
|
||||
|
|
@ -3444,39 +3438,39 @@ export class OrganizationController extends Controller {
|
|||
profile.position = position?.positionName ?? _null;
|
||||
await this.profileRepo.save(profile);
|
||||
}
|
||||
const profileSalary = await this.salaryRepository.findOne({
|
||||
where: { profileId: item.next_holderId },
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
// const profileSalary = await this.salaryRepository.findOne({
|
||||
// where: { profileId: item.next_holderId },
|
||||
// order: { createdAt: "DESC" },
|
||||
// });
|
||||
|
||||
const shortName =
|
||||
item != null && item.orgChild4 != null
|
||||
? `${item.orgChild4.orgChild4ShortName}${item.posMasterNo}`
|
||||
: item != null && item?.orgChild3 != null
|
||||
? `${item.orgChild3.orgChild3ShortName}${item.posMasterNo}`
|
||||
: item != null && item?.orgChild2 != null
|
||||
? `${item.orgChild2.orgChild2ShortName}${item.posMasterNo}`
|
||||
: item != null && item?.orgChild1 != null
|
||||
? `${item.orgChild1.orgChild1ShortName}${item.posMasterNo}`
|
||||
: item != null && item?.orgRoot != null
|
||||
? `${item.orgRoot.orgRootShortName}${item.posMasterNo}`
|
||||
: null;
|
||||
await new FunctionMain().newSalaryFunction(request, {
|
||||
profileId: item.next_holderId,
|
||||
date: new Date(),
|
||||
amount: profileSalary?.amount ?? null,
|
||||
positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null,
|
||||
mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null,
|
||||
posNo: shortName,
|
||||
position: position?.positionName ?? _null,
|
||||
positionLine: position?.positionField ?? _null,
|
||||
positionPathSide: position?.positionArea ?? _null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? _null,
|
||||
positionType: position?.posType?.posTypeName ?? _null,
|
||||
positionLevel: position?.posLevel?.posLevelName ?? _null,
|
||||
refCommandNo: null,
|
||||
templateDoc: "ปรับโครงสร้าง",
|
||||
});
|
||||
// const shortName =
|
||||
// item != null && item.orgChild4 != null
|
||||
// ? `${item.orgChild4.orgChild4ShortName}${item.posMasterNo}`
|
||||
// : item != null && item?.orgChild3 != null
|
||||
// ? `${item.orgChild3.orgChild3ShortName}${item.posMasterNo}`
|
||||
// : item != null && item?.orgChild2 != null
|
||||
// ? `${item.orgChild2.orgChild2ShortName}${item.posMasterNo}`
|
||||
// : item != null && item?.orgChild1 != null
|
||||
// ? `${item.orgChild1.orgChild1ShortName}${item.posMasterNo}`
|
||||
// : item != null && item?.orgRoot != null
|
||||
// ? `${item.orgRoot.orgRootShortName}${item.posMasterNo}`
|
||||
// : null;
|
||||
// await new FunctionMain().newSalaryFunction(request, {
|
||||
// profileId: item.next_holderId,
|
||||
// date: new Date(),
|
||||
// amount: profileSalary?.amount ?? null,
|
||||
// positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null,
|
||||
// mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null,
|
||||
// posNo: shortName,
|
||||
// position: position?.positionName ?? _null,
|
||||
// positionLine: position?.positionField ?? _null,
|
||||
// positionPathSide: position?.positionArea ?? _null,
|
||||
// positionExecutive: position?.posExecutive?.posExecutiveName ?? _null,
|
||||
// positionType: position?.posType?.posTypeName ?? _null,
|
||||
// positionLevel: position?.posLevel?.posLevelName ?? _null,
|
||||
// refCommandNo: null,
|
||||
// templateDoc: "ปรับโครงสร้าง",
|
||||
// });
|
||||
}
|
||||
item.current_holderId = item.next_holderId;
|
||||
item.next_holderId = null;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -18,12 +18,9 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -38,16 +32,13 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PermissionOrgController extends Controller {
|
||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||
private profileRepository = AppDataSource.getRepository(Profile);
|
||||
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 หาสำนักทั้งหมดแบบร่าง
|
||||
|
|
@ -481,7 +472,7 @@ export class PermissionOrgController extends Controller {
|
|||
_permissionOrg.lastUpdateFullName = request.user.name;
|
||||
_permissionOrg.createdAt = new Date();
|
||||
_permissionOrg.lastUpdatedAt = new Date();
|
||||
await this.permissionOrgRepository.save(_permissionOrg, {data:request});
|
||||
await this.permissionOrgRepository.save(_permissionOrg, { data: request });
|
||||
setLogDataDiff(request, { before, after: _permissionOrg });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -521,7 +512,7 @@ export class PermissionOrgController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสิทธิ์นี้อยู่ในระบบแล้ว");
|
||||
}
|
||||
|
||||
await this.permissionOrgRepository.remove(_delPermissionOrg, {data:req});
|
||||
await this.permissionOrgRepository.remove(_delPermissionOrg, { data: req });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -31,7 +29,6 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PosExecutiveController extends Controller {
|
||||
private posExecutiveRepository = AppDataSource.getRepository(PosExecutive);
|
||||
private positionRepository = AppDataSource.getRepository(Position);
|
||||
|
|
@ -85,8 +82,8 @@ export class PosExecutiveController extends Controller {
|
|||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.createdAt = new Date();
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
await this.posExecutiveRepository.save(posExecutive, {data: request});
|
||||
setLogDataDiff(request, {before, after: posExecutive});
|
||||
await this.posExecutiveRepository.save(posExecutive, { data: request });
|
||||
setLogDataDiff(request, { before, after: posExecutive });
|
||||
return new HttpSuccess(posExecutive.id);
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +144,8 @@ export class PosExecutiveController extends Controller {
|
|||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
// this.posExecutiveRepository.merge(posExecutive, requestBody);
|
||||
await this.posExecutiveRepository.save(posExecutive, {data: request});
|
||||
setLogDataDiff(request, {before, after: posExecutive});
|
||||
await this.posExecutiveRepository.save(posExecutive, { data: request });
|
||||
setLogDataDiff(request, { before, after: posExecutive });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -31,7 +28,6 @@ import { Not } from "typeorm";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PosLevelController extends Controller {
|
||||
private posTypeRepository = AppDataSource.getRepository(PosType);
|
||||
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -30,7 +28,6 @@ import Extension from "../interfaces/extension";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PosMasterActController extends Controller {
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -33,10 +30,8 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PosTypeController extends Controller {
|
||||
private posTypeRepository = AppDataSource.getRepository(PosType);
|
||||
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||
|
||||
/**
|
||||
* API เพิ่มประเภทตำแหน่ง
|
||||
|
|
@ -73,8 +68,8 @@ export class PosTypeController extends Controller {
|
|||
posType.lastUpdateFullName = request.user.name;
|
||||
posType.createdAt = new Date();
|
||||
posType.lastUpdatedAt = new Date();
|
||||
await this.posTypeRepository.save(posType, {data: request});
|
||||
setLogDataDiff(request, {before , after: posType});
|
||||
await this.posTypeRepository.save(posType, { data: request });
|
||||
setLogDataDiff(request, { before, after: posType });
|
||||
return new HttpSuccess(posType);
|
||||
}
|
||||
|
||||
|
|
@ -113,8 +108,8 @@ export class PosTypeController extends Controller {
|
|||
posType.lastUpdateFullName = request.user.name;
|
||||
posType.lastUpdatedAt = new Date();
|
||||
this.posTypeRepository.merge(posType, requestBody);
|
||||
await this.posTypeRepository.save(posType, {data: request});
|
||||
setLogDataDiff(request,{ before, after:posType });
|
||||
await this.posTypeRepository.save(posType, { data: request });
|
||||
setLogDataDiff(request, { before, after: posType });
|
||||
return new HttpSuccess(posType.id);
|
||||
}
|
||||
|
||||
|
|
@ -130,10 +125,10 @@ export class PosTypeController extends Controller {
|
|||
let result: any;
|
||||
try {
|
||||
result = await this.posTypeRepository.findOne({ where: { id } });
|
||||
if(!result){
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
|
||||
}
|
||||
await this.posTypeRepository.remove(result, {data: result});
|
||||
await this.posTypeRepository.remove(result, { data: result });
|
||||
} catch {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -52,7 +48,6 @@ import { Assign } from "../entities/Assign";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PositionController extends Controller {
|
||||
private posExecutiveRepository = AppDataSource.getRepository(PosExecutive);
|
||||
private posTypeRepository = AppDataSource.getRepository(PosType);
|
||||
|
|
@ -151,7 +146,7 @@ export class PositionController extends Controller {
|
|||
posDict.lastUpdateFullName = request.user.name;
|
||||
posDict.createdAt = new Date();
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
await this.posDictRepository.save(posDict, {data: request});
|
||||
await this.posDictRepository.save(posDict, { data: request });
|
||||
setLogDataDiff(request, { before, after: posDict });
|
||||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
|
@ -223,7 +218,7 @@ export class PositionController extends Controller {
|
|||
where: { posMasterId: posMaster.id },
|
||||
});
|
||||
if (posMasterAssigns.length > 0) {
|
||||
await this.posMasterAssignRepo.remove(posMasterAssigns, {data:request});
|
||||
await this.posMasterAssignRepo.remove(posMasterAssigns, { data: request });
|
||||
}
|
||||
// await this.posMasterAssignRepo.delete({ posMasterId: posMaster.id });
|
||||
return new HttpSuccess();
|
||||
|
|
@ -307,8 +302,8 @@ export class PositionController extends Controller {
|
|||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.createdAt = new Date();
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
await this.posExecutiveRepository.save(posExecutive, {data:request});
|
||||
setLogDataDiff(request, {before, after: posExecutive});
|
||||
await this.posExecutiveRepository.save(posExecutive, { data: request });
|
||||
setLogDataDiff(request, { before, after: posExecutive });
|
||||
}
|
||||
|
||||
const rowRepeated = await this.posDictRepository.findOne({
|
||||
|
|
@ -334,8 +329,8 @@ export class PositionController extends Controller {
|
|||
posDict.lastUpdateFullName = request.user.name;
|
||||
posDict.createdAt = new Date();
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
await this.posDictRepository.save(posDict, {data:request});
|
||||
setLogDataDiff(request, {before, after: posDict});
|
||||
await this.posDictRepository.save(posDict, { data: request });
|
||||
setLogDataDiff(request, { before, after: posDict });
|
||||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
||||
|
|
@ -433,8 +428,8 @@ export class PositionController extends Controller {
|
|||
posDict.posDictArea = requestBody.posDictArea ? requestBody.posDictArea : "";
|
||||
posDict.isSpecial = requestBody.isSpecial;
|
||||
// this.posDictRepository.merge(posDict, requestBody);
|
||||
await this.posDictRepository.save(posDict, {data:request});
|
||||
setLogDataDiff(request, {before, after: posDict});
|
||||
await this.posDictRepository.save(posDict, { data: request });
|
||||
setLogDataDiff(request, { before, after: posDict });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -452,7 +447,7 @@ export class PositionController extends Controller {
|
|||
if (!delPosDict) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้");
|
||||
}
|
||||
await this.posDictRepository.remove(delPosDict, {data: request});
|
||||
await this.posDictRepository.remove(delPosDict, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -4053,4 +4048,113 @@ export class PositionController extends Controller {
|
|||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายชื่อตามกลุ่มในโครงสร้าง
|
||||
*
|
||||
* @summary รายชื่อตามกลุ่มในโครงสร้าง
|
||||
*
|
||||
*/
|
||||
@Post("report/draft")
|
||||
async reportDraft(
|
||||
@Body()
|
||||
body: {
|
||||
type: string;
|
||||
rootId: string;
|
||||
},
|
||||
) {
|
||||
let conditionGroup = "";
|
||||
if (body.type.trim().toUpperCase() == "GROUP1.1") {
|
||||
conditionGroup =
|
||||
"(posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'ชำนาญงาน') OR (posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'ปฏิบัติงาน') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ปฏิบัติการ') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ชำนาญการ')";
|
||||
} else if (body.type.trim().toUpperCase() == "GROUP1.2") {
|
||||
conditionGroup =
|
||||
"(posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'อาวุโส') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ชำนาญการพิเศษ') OR (posType.posTypeName = 'อำนวยการ' AND posLevel.posLevelName = 'ต้น')";
|
||||
} else if (body.type.trim().toUpperCase() == "GROUP2") {
|
||||
conditionGroup =
|
||||
"(posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'ทักษะพิเศษ') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'เชี่ยวชาญ') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ทรงคุณวุฒิ') OR (posType.posTypeName = 'อำนวยการ' AND posLevel.posLevelName = 'สูง') OR (posType.posTypeName = 'บริหาร' AND posLevel.posLevelName = 'ต้น') OR (posType.posTypeName = 'บริหาร' AND posLevel.posLevelName = 'สูง')";
|
||||
} else {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "กลุ่มเป้าหมายไม่ถูกต้อง");
|
||||
}
|
||||
|
||||
let posMaster = await AppDataSource.getRepository(PosMaster)
|
||||
.createQueryBuilder("posMaster")
|
||||
.leftJoinAndSelect("posMaster.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("posMaster.orgChild1", "orgChild1")
|
||||
.leftJoinAndSelect("posMaster.orgChild2", "orgChild2")
|
||||
.leftJoinAndSelect("posMaster.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("posMaster.orgChild4", "orgChild4")
|
||||
.leftJoinAndSelect("posMaster.next_holder", "next_holder")
|
||||
.leftJoinAndSelect("posMaster.positions", "positions")
|
||||
.leftJoinAndSelect("positions.posType", "posType")
|
||||
.leftJoinAndSelect("positions.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("posMaster.orgRevision", "orgRevision")
|
||||
.andWhere("posMaster.orgRootId LIKE :orgRootId", {
|
||||
orgRootId: body.type.trim().toUpperCase() == "GROUP1" ? body.rootId : `%%`,
|
||||
})
|
||||
.andWhere("posMaster.statusReport = :statusReport", { statusReport: "PENDING" })
|
||||
.andWhere("posMaster.next_holderId IS NOT NULL")
|
||||
.andWhere("orgRevision.orgRevisionIsCurrent = :orgRevisionIsCurrent", {
|
||||
orgRevisionIsCurrent: false,
|
||||
})
|
||||
.andWhere("orgRevision.orgRevisionIsDraft = :orgRevisionIsDraft", {
|
||||
orgRevisionIsDraft: true,
|
||||
})
|
||||
.andWhere("positions.positionIsSelected = :isSelected", { isSelected: true })
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(conditionGroup);
|
||||
}),
|
||||
)
|
||||
.orderBy("posMaster.posMasterOrder", "ASC")
|
||||
.select([
|
||||
"posMaster.id",
|
||||
"posMaster.posMasterNo",
|
||||
"positions.positionName",
|
||||
"positions.positionIsSelected",
|
||||
"posType.posTypeName",
|
||||
"posLevel.posLevelName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgChild1.orgChild1ShortName",
|
||||
"orgChild2.orgChild2ShortName",
|
||||
"orgChild3.orgChild3ShortName",
|
||||
"orgChild4.orgChild4ShortName",
|
||||
"next_holder.prefix",
|
||||
"next_holder.firstName",
|
||||
"next_holder.lastName",
|
||||
])
|
||||
.getMany();
|
||||
const _posMaster = posMaster.map((x) => {
|
||||
const posMasterNo =
|
||||
x.orgChild4 != null
|
||||
? `${x.orgChild4.orgChild4ShortName}${x.posMasterNo}`
|
||||
: x != null && x?.orgChild3 != null
|
||||
? `${x.orgChild3.orgChild3ShortName}${x.posMasterNo}`
|
||||
: x != null && x?.orgChild2 != null
|
||||
? `${x.orgChild2.orgChild2ShortName}${x.posMasterNo}`
|
||||
: x != null && x?.orgChild1 != null
|
||||
? `${x.orgChild1.orgChild1ShortName}${x.posMasterNo}`
|
||||
: x != null && x?.orgRoot != null
|
||||
? `${x.orgRoot.orgRootShortName}${x.posMasterNo}`
|
||||
: null;
|
||||
const position =
|
||||
x.positions.filter((x) => x.positionIsSelected == true).length > 0
|
||||
? x.positions.filter((x) => x.positionIsSelected == true)[0]
|
||||
: null;
|
||||
return {
|
||||
id: x.id,
|
||||
posMasterNo: posMasterNo,
|
||||
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,
|
||||
citizenId: x.next_holder?.citizenId || null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess(_posMaster);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
@ -30,7 +28,6 @@ import { request } from "axios";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class PrefixController extends Controller {
|
||||
private prefixRepository = AppDataSource.getRepository(Prefixe);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { Profile } from "../entities/Profile";
|
|||
import { CreateProfileEdit, EditProfileEdit, ProfileEdit } from "../entities/ProfileEdit";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Brackets } from "typeorm";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
|
||||
@Route("api/v1/org/profile/edit")
|
||||
@Tags("ProfileEdit")
|
||||
|
|
@ -184,7 +185,10 @@ export class ProfileEditController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newProfileEdit(@Request() req: RequestWithUser, @Body() body: CreateProfileEdit) {
|
||||
const profile = await this.profileRepo.findOneBy({ keycloak: req.user.sub });
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: req.user.sub },
|
||||
relations: ["posLevel", "posLevel.posLevelName", "posType", "posType.posTypeName"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
|
|
@ -203,6 +207,17 @@ export class ProfileEditController extends Controller {
|
|||
data.status = "PENDING";
|
||||
await this.profileEditRepo.save(data);
|
||||
|
||||
await new CallAPI()
|
||||
.PostData(req, "/org/workflow/add-workflow", {
|
||||
refId: data.id,
|
||||
sysName: "REGISTRY_PROFILE",
|
||||
posLevelName: profile.posLevel.posLevelName,
|
||||
posTypeName: profile.posType.posTypeName,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error calling API:", error);
|
||||
});
|
||||
|
||||
return new HttpSuccess(data.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ import {
|
|||
} from "../entities/ProfileEmployeeEmployment";
|
||||
import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import { EmployeePosition } from "../entities/EmployeePosition";
|
||||
import { ProfileInsignia } from "../entities/ProfileInsignia";
|
||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||
import permission from "../interfaces/permission";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Delete,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Example, Get, Patch, Path, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import {
|
||||
CreateProfileEmployeeGovernment,
|
||||
ProfileGovernment,
|
||||
UpdateProfileGovernment,
|
||||
} from "../entities/ProfileGovernment";
|
||||
import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
|
||||
import { EmployeePosition } from "../entities/EmployeePosition";
|
||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
|
||||
|
|
|
|||
|
|
@ -1,28 +1,11 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
Delete,
|
||||
Post,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
import { Body, Controller, Example, Get, Patch, Path, Request, Route, Security, Tags } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import {
|
||||
CreateProfileEmployeeGovernment,
|
||||
ProfileGovernment,
|
||||
UpdateProfileGovernment,
|
||||
} from "../entities/ProfileGovernment";
|
||||
import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
|
||||
import { EmployeePosition } from "../entities/EmployeePosition";
|
||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {
|
|||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {
|
|||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {
|
|||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {
|
|||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -29,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class ProvinceController extends Controller {
|
||||
private provinceRepository = AppDataSource.getRepository(Province);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -28,7 +27,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class RankController extends Controller {
|
||||
private rankRepository = AppDataSource.getRepository(Rank);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -21,7 +20,6 @@ import { CreateRelationship, Relationship } from "../entities/Relationship";
|
|||
import { Not } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
import { request } from "axios";
|
||||
@Route("api/v1/org/metadata/relationship")
|
||||
@Tags("Relationship")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -29,7 +27,6 @@ import { request } from "axios";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class RelationshipController extends Controller {
|
||||
private relationshipRepository = AppDataSource.getRepository(Relationship);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -28,7 +27,6 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class ReligionController extends Controller {
|
||||
private religionRepository = AppDataSource.getRepository(Religion);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import Extension from "../interfaces/extension";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class ReportController extends Controller {
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Get,
|
||||
} from "tsoa";
|
||||
|
|
@ -30,7 +29,6 @@ import { setLogDataDiff } from "../interfaces/utils";
|
|||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class SubDistrictController extends Controller {
|
||||
private subDistrictRepository = AppDataSource.getRepository(SubDistrict);
|
||||
private districtRepository = AppDataSource.getRepository(District);
|
||||
|
|
|
|||
|
|
@ -30,15 +30,11 @@ import {
|
|||
getRoleMappings,
|
||||
getUserCount,
|
||||
enableStatus,
|
||||
getUserCountOrg,
|
||||
getUserListOrg,
|
||||
} from "../keycloak";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import { IsNull, Not } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
// import * as io from "../lib/websocket";
|
||||
// import elasticsearch from "../elasticsearch";
|
||||
// import { StorageFolder } from "../interfaces/storage-fs";
|
||||
|
|
|
|||
|
|
@ -263,26 +263,31 @@ export class WorkflowController extends Controller {
|
|||
},
|
||||
relations: ["workflow"],
|
||||
});
|
||||
if (!stateOperatorUser)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
refId: body.refId,
|
||||
sysName: body.system,
|
||||
},
|
||||
});
|
||||
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
|
||||
const operator = await this.stateOperatorRepo.findOne({
|
||||
where: {
|
||||
operator: stateOperatorUser.operator,
|
||||
stateId: stateOperatorUser.workflow.stateId,
|
||||
operator: stateOperatorUser?.operator || "",
|
||||
stateId: workflow.stateId,
|
||||
},
|
||||
relations: ["state"],
|
||||
});
|
||||
if (!operator) {
|
||||
const state = await this.stateRepo.findOne({
|
||||
where: {
|
||||
id: stateOperatorUser.workflow.stateId,
|
||||
id: workflow.stateId,
|
||||
},
|
||||
});
|
||||
return new HttpSuccess({
|
||||
stateId: state?.id || null,
|
||||
stateNo: state?.order || null,
|
||||
stateName: state?.name || null,
|
||||
operator: stateOperatorUser.operator,
|
||||
operator: stateOperatorUser?.operator || null,
|
||||
can_view: false,
|
||||
can_update: false,
|
||||
can_operate: false,
|
||||
|
|
@ -333,6 +338,7 @@ export class WorkflowController extends Controller {
|
|||
prefix: x.profile.prefix,
|
||||
firstName: x.profile.firstName,
|
||||
lastName: x.profile.lastName,
|
||||
isComment: x.profile.keycloak == req.user.sub ? true : false,
|
||||
profileId: x.profileId,
|
||||
isAcceptSetting: x.isAcceptSetting,
|
||||
isApproveSetting: x.isApproveSetting,
|
||||
|
|
@ -540,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.isApprove = body.isApprove == null ? _null : body.isApprove;
|
||||
stateUserComment.reason = body.reason == null ? _null : body.reason;
|
||||
stateUserComment.lastUpdateUserId = req.user.sub;
|
||||
stateUserComment.lastUpdateFullName = req.user.name;
|
||||
stateUserComment.lastUpdatedAt = new Date();
|
||||
|
|
@ -614,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,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from "typeorm";
|
||||
import { CommandType } from "./CommandType";
|
||||
import { PosMasterAssign } from "./PosMasterAssign";
|
||||
import { CommandSys } from "./CommandSys";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne } from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { AuthRoleAttr } from "./AuthRoleAttr";
|
||||
import { PosMaster } from "./PosMaster";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { AuthSys } from "./AuthSys";
|
||||
import { AuthRole } from "./AuthRole";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { Entity, Column } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
||||
@Entity("bloodGroup")
|
||||
export class BloodGroup extends EntityBase {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ProfileChangePosition } from "./ProfileChangePosition";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { CommandType } from "./CommandType";
|
|||
import { CommandSend } from "./CommandSend";
|
||||
import { CommandSalary } from "./CommandSalary";
|
||||
import { CommandRecive } from "./CommandRecive";
|
||||
import { ProfileSalary } from "./ProfileSalary";
|
||||
|
||||
@Entity("command")
|
||||
export class Command extends EntityBase {
|
||||
|
|
@ -151,6 +152,9 @@ export class Command extends EntityBase {
|
|||
|
||||
@OneToMany(() => CommandRecive, (commandRecive) => commandRecive.command)
|
||||
commandRecives: CommandRecive[];
|
||||
|
||||
@OneToMany(() => ProfileSalary, (profileSalary) => profileSalary.command)
|
||||
profileSalarys: ProfileSalary[];
|
||||
}
|
||||
|
||||
export class CreateCommand {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, JoinColumn, ManyToOne, OneToMany, Double } from "typeorm";
|
||||
import { Entity, Column, JoinColumn, ManyToOne, Double } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Command } from "./Command";
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
import { CommandType } from "./CommandType";
|
||||
import { CommandSalary } from "./CommandSalary";
|
||||
import { Assign } from "./Assign";
|
||||
import { Workflow } from "./Workflow";
|
||||
|
||||
@Entity("commandSys")
|
||||
export class CommandSys {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { Entity, Column } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
||||
@Entity("gender")
|
||||
export class Gender extends EntityBase {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_EDUCATION")
|
||||
export class HR_EDUCATION {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_EDUCATION_EMP")
|
||||
export class HR_EDUCATION_EMP {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_PERSONAL_EMP_ADDRESS")
|
||||
export class HR_PERSONAL_EMP_ADDRESS {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_PERSONAL_EMP_FAMILY")
|
||||
export class HR_PERSONAL_EMP_FAMILY {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_PERSONAL_OFFICER_ADDRESS")
|
||||
export class HR_PERSONAL_OFFICER_ADDRESS {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_PERSONAL_OFFICER_FAMILY")
|
||||
export class HR_PERSONAL_OFFICER_FAMILY {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity("HR_POSITION_OFFICER")
|
||||
export class HR_POSITION_OFFICER {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
|
||||
import { ProfileLeave } from "./ProfileLeave";
|
||||
|
||||
@Entity("leaveType")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { MetaState } from "./MetaState";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { OrgRoot } from "./OrgRoot";
|
||||
import { OrgChild2 } from "./OrgChild2";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { OrgRoot } from "./OrgRoot";
|
||||
import { OrgChild1 } from "./OrgChild1";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { OrgRoot } from "./OrgRoot";
|
||||
import { OrgChild1 } from "./OrgChild1";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { OrgRoot } from "./OrgRoot";
|
||||
import { PosMaster } from "./PosMaster";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany, ManyToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { OrgChild1 } from "./OrgChild1";
|
||||
import { OrgRevision } from "./OrgRevision";
|
||||
|
|
@ -6,7 +6,6 @@ import { OrgChild2 } from "./OrgChild2";
|
|||
import { OrgChild3 } from "./OrgChild3";
|
||||
import { OrgChild4 } from "./OrgChild4";
|
||||
import { PosMaster } from "./PosMaster";
|
||||
import { Profile } from "./Profile";
|
||||
import { PermissionOrg } from "./PermissionOrg";
|
||||
|
||||
enum OrgRootRank {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { PosExecutive } from "./PosExecutive";
|
||||
import { PosType } from "./PosType";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Position } from "./Position";
|
||||
import { PosDict } from "./PosDict";
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -195,6 +195,13 @@ export class PosMaster extends EntityBase {
|
|||
})
|
||||
authRoleId: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะออกคำสั่ง",
|
||||
default: "PENDING",
|
||||
length: 20,
|
||||
})
|
||||
statusReport: string;
|
||||
|
||||
@ManyToOne(() => AuthRole, (authRole) => authRole.posMasters)
|
||||
@JoinColumn({ name: "authRoleId" })
|
||||
authRole: AuthRole;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { PosMaster } from "./PosMaster";
|
||||
import { PosLevel } from "./PosLevel";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, JoinColumn, ManyToOne, ManyToMany } from "typeorm";
|
||||
import { Entity, Column, OneToMany, JoinColumn, ManyToOne } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { PosMaster } from "./PosMaster";
|
||||
import { PosLevel } from "./PosLevel";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileAbility } from "./ProfileAbility";
|
||||
|
||||
@Entity("profileAbilityHistory")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileAssessment } from "./ProfileAssessment";
|
||||
|
||||
@Entity("profileAssessmentHistory")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileCertificate } from "./ProfileCertificate";
|
||||
|
||||
@Entity("profileCertificateHistory")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
// import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileChangeName } from "./ProfileChangeName";
|
||||
|
||||
@Entity("profileChangeNameHistory")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||
import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
import { ProfileChildren } from "./ProfileChildren";
|
||||
|
||||
@Entity("profileChildrenHistory")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileDiscipline } from "./ProfileDiscipline";
|
||||
|
||||
@Entity("profileDisciplineHistory")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileDuty } from "./ProfileDuty";
|
||||
|
||||
@Entity("profileDutyHistory")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEducation } from "./ProfileEducation";
|
||||
|
||||
@Entity("profileEducationHistory")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import { ProfileFamilyFather } from "./ProfileFamilyFather";
|
|||
import { ProfileFamilyMother } from "./ProfileFamilyMother";
|
||||
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
|
||||
import { ProfileChildren } from "./ProfileChildren";
|
||||
import { Profile, ProfileAddressHistory } from "./Profile";
|
||||
import { ProfileAddressHistory } from "./Profile";
|
||||
import { Province } from "./Province";
|
||||
import { District } from "./District";
|
||||
import { SubDistrict } from "./SubDistrict";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||
import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue