Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-10-18 12:10:54 +07:00
commit e5b1c3b8d5
113 changed files with 455 additions and 505 deletions

View file

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

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -28,7 +27,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class BloodGroupController extends Controller { export class BloodGroupController extends Controller {
private bloodGroupRepository = AppDataSource.getRepository(BloodGroup); private bloodGroupRepository = AppDataSource.getRepository(BloodGroup);

View file

@ -10,7 +10,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Query, Query,
} from "tsoa"; } from "tsoa";
@ -44,7 +43,6 @@ import CallAPI from "../interfaces/call-api";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ChangePositionController extends Controller { export class ChangePositionController extends Controller {
private changePositionRepository = AppDataSource.getRepository(ChangePosition); private changePositionRepository = AppDataSource.getRepository(ChangePosition);
private profileChangePositionRepository = AppDataSource.getRepository(ProfileChangePosition); private profileChangePositionRepository = AppDataSource.getRepository(ProfileChangePosition);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
Query, Query,
@ -19,7 +18,7 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { Command } from "../entities/Command"; 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 { CommandType } from "../entities/CommandType";
import { CommandSend } from "../entities/CommandSend"; import { CommandSend } from "../entities/CommandSend";
import { Profile, CreateProfileAllFields } from "../entities/Profile"; import { Profile, CreateProfileAllFields } from "../entities/Profile";
@ -64,7 +63,6 @@ import permission from "../interfaces/permission";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandController extends Controller { export class CommandController extends Controller {
private commandRepository = AppDataSource.getRepository(Command); private commandRepository = AppDataSource.getRepository(Command);
private commandTypeRepository = AppDataSource.getRepository(CommandType); 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(); return new HttpSuccess();
} }
@Post("command38/officer/report") @Post("command38/officer/report")
@ -2757,6 +2811,37 @@ export class CommandController extends Controller {
refIds: string[]; 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(); return new HttpSuccess();
} }

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
Query, Query,
@ -19,7 +18,6 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { CommandSalary, CreateCommandSalary, UpdateCommandSalary } from "../entities/CommandSalary"; import { CommandSalary, CreateCommandSalary, UpdateCommandSalary } from "../entities/CommandSalary";
import { Not } from "typeorm";
import { CommandSys } from "../entities/CommandSys"; import { CommandSys } from "../entities/CommandSys";
@Route("api/v1/org/commandSalary") @Route("api/v1/org/commandSalary")
@ -29,7 +27,6 @@ import { CommandSys } from "../entities/CommandSys";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandSalaryController extends Controller { export class CommandSalaryController extends Controller {
private commandSalaryRepository = AppDataSource.getRepository(CommandSalary); private commandSalaryRepository = AppDataSource.getRepository(CommandSalary);
private commandSysRepository = AppDataSource.getRepository(CommandSys); private commandSysRepository = AppDataSource.getRepository(CommandSys);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -26,7 +25,6 @@ import { CommandSys, CreateCommandSys, UpdateCommandSys } from "../entities/Comm
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandSysController extends Controller { export class CommandSysController extends Controller {
private commandSysRepository = AppDataSource.getRepository(CommandSys); private commandSysRepository = AppDataSource.getRepository(CommandSys);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
Query, Query,
@ -19,7 +18,6 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { CommandType, CreateCommandType, UpdateCommandType } from "../entities/CommandType"; import { CommandType, CreateCommandType, UpdateCommandType } from "../entities/CommandType";
import { Not } from "typeorm";
import { CommandSys } from "../entities/CommandSys"; import { CommandSys } from "../entities/CommandSys";
@Route("api/v1/org/commandType") @Route("api/v1/org/commandType")
@ -29,7 +27,6 @@ import { CommandSys } from "../entities/CommandSys";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class CommandTypeController extends Controller { export class CommandTypeController extends Controller {
private commandTypeRepository = AppDataSource.getRepository(CommandType); private commandTypeRepository = AppDataSource.getRepository(CommandType);
private commandSysRepository = AppDataSource.getRepository(CommandSys); private commandSysRepository = AppDataSource.getRepository(CommandSys);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -30,7 +29,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class DistrictController extends Controller { export class DistrictController extends Controller {
private districtRepository = AppDataSource.getRepository(District); private districtRepository = AppDataSource.getRepository(District);
private provinceRepository = AppDataSource.getRepository(Province); private provinceRepository = AppDataSource.getRepository(Province);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -28,7 +27,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EducationLevelController extends Controller { export class EducationLevelController extends Controller {
private educationLevelRepository = AppDataSource.getRepository(EducationLevel); private educationLevelRepository = AppDataSource.getRepository(EducationLevel);

View file

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

View file

@ -10,7 +10,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
@ -35,11 +34,8 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EmployeePosTypeController extends Controller { export class EmployeePosTypeController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType); private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
private employeePosLevelRepository = AppDataSource.getRepository(EmployeePosLevel);
/** /**
* API * API
* *
@ -81,8 +77,8 @@ export class EmployeePosTypeController extends Controller {
EmpPosType.lastUpdateFullName = request.user.name; EmpPosType.lastUpdateFullName = request.user.name;
EmpPosType.createdAt = new Date(); EmpPosType.createdAt = new Date();
EmpPosType.lastUpdatedAt = new Date(); EmpPosType.lastUpdatedAt = new Date();
await this.employeePosTypeRepository.save(EmpPosType, {data: request}); await this.employeePosTypeRepository.save(EmpPosType, { data: request });
setLogDataDiff(request, {before, after: EmpPosType}); setLogDataDiff(request, { before, after: EmpPosType });
return new HttpSuccess(EmpPosType.id); return new HttpSuccess(EmpPosType.id);
} }
@ -129,8 +125,8 @@ export class EmployeePosTypeController extends Controller {
EmpPosType.lastUpdateFullName = request.user.name; EmpPosType.lastUpdateFullName = request.user.name;
EmpPosType.lastUpdatedAt = new Date(); EmpPosType.lastUpdatedAt = new Date();
this.employeePosTypeRepository.merge(EmpPosType, requestBody); this.employeePosTypeRepository.merge(EmpPosType, requestBody);
await this.employeePosTypeRepository.save(EmpPosType, {data: request}); await this.employeePosTypeRepository.save(EmpPosType, { data: request });
setLogDataDiff(request, {before, after: EmpPosType}); setLogDataDiff(request, { before, after: EmpPosType });
return new HttpSuccess(EmpPosType.id); return new HttpSuccess(EmpPosType.id);
} }
@ -147,8 +143,8 @@ export class EmployeePosTypeController extends Controller {
try { try {
result = await this.employeePosTypeRepository.findOne({ result = await this.employeePosTypeRepository.findOne({
where: { id: id }, where: { id: id },
}) });
await this.employeePosTypeRepository.remove(result, {data: request}); await this.employeePosTypeRepository.remove(result, { data: request });
} catch { } catch {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,

View file

@ -10,7 +10,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Query, Query,
} from "tsoa"; } from "tsoa";
@ -38,9 +37,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
import { AuthRole } from "../entities/AuthRole"; import { AuthRole } from "../entities/AuthRole";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { request } from "axios";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
import { after } from "node:test";
@Route("api/v1/org/employee/pos") @Route("api/v1/org/employee/pos")
@Tags("Employee") @Tags("Employee")
@Security("bearerAuth") @Security("bearerAuth")
@ -48,7 +45,6 @@ import { after } from "node:test";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class EmployeePositionController extends Controller { export class EmployeePositionController extends Controller {
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict); private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType); private employeePosTypeRepository = AppDataSource.getRepository(EmployeePosType);
@ -169,8 +165,8 @@ export class EmployeePositionController extends Controller {
empPosDict.lastUpdateFullName = request.user.name; empPosDict.lastUpdateFullName = request.user.name;
empPosDict.lastUpdatedAt = new Date(); empPosDict.lastUpdatedAt = new Date();
this.employeePosDictRepository.merge(empPosDict, requestBody); this.employeePosDictRepository.merge(empPosDict, requestBody);
await this.employeePosDictRepository.save(empPosDict,{data: request}); await this.employeePosDictRepository.save(empPosDict, { data: request });
setLogDataDiff( request, { before, after: empPosDict }); setLogDataDiff(request, { before, after: empPosDict });
return new HttpSuccess(empPosDict.id); return new HttpSuccess(empPosDict.id);
} }

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -29,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class GenderController extends Controller { export class GenderController extends Controller {
private genderRepository = AppDataSource.getRepository(Gender); private genderRepository = AppDataSource.getRepository(Gender);

View file

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

View file

@ -4,24 +4,20 @@ import {
Post, Post,
Put, Put,
Delete, Delete,
Patch,
Route, Route,
Security, Security,
Tags, Tags,
Body, Body,
Path, Path,
Request, Request,
Example,
SuccessResponse,
Response, Response,
Query,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; 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 { InsigniaType } from "../entities/InsigniaType";
import { Insignia, CreateInsignias, UpdateInsignias } from "../entities/Insignia"; import { Insignia, CreateInsignias, UpdateInsignias } from "../entities/Insignia";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
@ -32,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class InsigniaController extends Controller { export class InsigniaController extends Controller {
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType); private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
private insigniaRepository = AppDataSource.getRepository(Insignia); private insigniaRepository = AppDataSource.getRepository(Insignia);

View file

@ -4,23 +4,19 @@ import {
Post, Post,
Put, Put,
Delete, Delete,
Patch,
Route, Route,
Security, Security,
Tags, Tags,
Body, Body,
Path, Path,
Request, Request,
Example,
SuccessResponse,
Response, Response,
Query,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; 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 { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
import { Insignia } from "../entities/Insignia"; import { Insignia } from "../entities/Insignia";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
@ -33,7 +29,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class InsigniaTypeController extends Controller { export class InsigniaTypeController extends Controller {
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType); private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
private insigniaRepository = AppDataSource.getRepository(Insignia); private insigniaRepository = AppDataSource.getRepository(Insignia);
@ -110,7 +105,7 @@ export class InsigniaTypeController extends Controller {
insigniaType.lastUpdatedAt = new Date(); insigniaType.lastUpdatedAt = new Date();
this.insigniaTypeRepository.merge(insigniaType, requestBody); this.insigniaTypeRepository.merge(insigniaType, requestBody);
await this.insigniaTypeRepository.save(insigniaType, { data: request }); await this.insigniaTypeRepository.save(insigniaType, { data: request });
setLogDataDiff( request, { before, after: insigniaType }); setLogDataDiff(request, { before, after: insigniaType });
return new HttpSuccess(insigniaType.id); 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(); return new HttpSuccess();
} }

View file

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

View file

@ -4,21 +4,7 @@ import { OrgRoot } from "../entities/OrgRoot";
import { OrgChild1, CreateOrgChild1, UpdateOrgChild1 } from "../entities/OrgChild1"; import { OrgChild1, CreateOrgChild1, UpdateOrgChild1 } from "../entities/OrgChild1";
import { OrgChild2 } from "../entities/OrgChild2"; import { OrgChild2 } from "../entities/OrgChild2";
import { OrgChild3 } from "../entities/OrgChild3"; import { OrgChild3 } from "../entities/OrgChild3";
import { import { Body, Delete, Get, Path, Post, Put, Response, Route, Tags, Request, Security } from "tsoa";
Body,
Delete,
Get,
Path,
Post,
Put,
Response,
Route,
SuccessResponse,
Tags,
Query,
Request,
Security,
} from "tsoa";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
@ -28,7 +14,6 @@ import { PosMaster } from "../entities/PosMaster";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosition } from "../entities/EmployeePosition";
import { Like } from "typeorm/browser";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
@ -39,7 +24,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrgChild1Controller { export class OrgChild1Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot); private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private child1Repository = AppDataSource.getRepository(OrgChild1); private child1Repository = AppDataSource.getRepository(OrgChild1);

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
} from "tsoa"; } from "tsoa";
import { CreateOrgRevision, OrgRevision } from "../entities/OrgRevision"; import { CreateOrgRevision, OrgRevision } from "../entities/OrgRevision";
@ -25,13 +24,11 @@ import { OrgChild3 } from "../entities/OrgChild3";
import { OrgChild4 } from "../entities/OrgChild4"; import { OrgChild4 } from "../entities/OrgChild4";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import CallAPI from "../interfaces/call-api";
import { ProfileSalary } from "../entities/ProfileSalary"; import { ProfileSalary } from "../entities/ProfileSalary";
import { Profile } from "../entities/Profile"; import { Profile } from "../entities/Profile";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { PermissionOrg } from "../entities/PermissionOrg"; import { PermissionOrg } from "../entities/PermissionOrg";
import FunctionMain from "../interfaces/functionMain";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
import { AuthRole } from "../entities/AuthRole"; import { AuthRole } from "../entities/AuthRole";
@ -42,7 +39,6 @@ import { AuthRole } from "../entities/AuthRole";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrganizationController extends Controller { export class OrganizationController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg); private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg);
@ -53,9 +49,7 @@ export class OrganizationController extends Controller {
private child4Repository = AppDataSource.getRepository(OrgChild4); private child4Repository = AppDataSource.getRepository(OrgChild4);
private posMasterRepository = AppDataSource.getRepository(PosMaster); private posMasterRepository = AppDataSource.getRepository(PosMaster);
private positionRepository = AppDataSource.getRepository(Position); private positionRepository = AppDataSource.getRepository(Position);
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
private profileRepo = AppDataSource.getRepository(Profile); private profileRepo = AppDataSource.getRepository(Profile);
private authRoleRepo = AppDataSource.getRepository(AuthRole);
/** /**
* API * API
@ -655,7 +649,7 @@ export class OrganizationController extends Controller {
}); });
}); });
} }
const _orgRevisions = await this.orgRevisionRepository.find({ const _orgRevisions = await this.orgRevisionRepository.find({
where: [{ orgRevisionIsDraft: true, id: Not(revision.id) }], where: [{ orgRevisionIsDraft: true, id: Not(revision.id) }],
}); });
@ -3444,39 +3438,39 @@ export class OrganizationController extends Controller {
profile.position = position?.positionName ?? _null; profile.position = position?.positionName ?? _null;
await this.profileRepo.save(profile); await this.profileRepo.save(profile);
} }
const profileSalary = await this.salaryRepository.findOne({ // const profileSalary = await this.salaryRepository.findOne({
where: { profileId: item.next_holderId }, // where: { profileId: item.next_holderId },
order: { createdAt: "DESC" }, // order: { createdAt: "DESC" },
}); // });
const shortName = // const shortName =
item != null && item.orgChild4 != null // item != null && item.orgChild4 != null
? `${item.orgChild4.orgChild4ShortName}${item.posMasterNo}` // ? `${item.orgChild4.orgChild4ShortName}${item.posMasterNo}`
: item != null && item?.orgChild3 != null // : item != null && item?.orgChild3 != null
? `${item.orgChild3.orgChild3ShortName}${item.posMasterNo}` // ? `${item.orgChild3.orgChild3ShortName}${item.posMasterNo}`
: item != null && item?.orgChild2 != null // : item != null && item?.orgChild2 != null
? `${item.orgChild2.orgChild2ShortName}${item.posMasterNo}` // ? `${item.orgChild2.orgChild2ShortName}${item.posMasterNo}`
: item != null && item?.orgChild1 != null // : item != null && item?.orgChild1 != null
? `${item.orgChild1.orgChild1ShortName}${item.posMasterNo}` // ? `${item.orgChild1.orgChild1ShortName}${item.posMasterNo}`
: item != null && item?.orgRoot != null // : item != null && item?.orgRoot != null
? `${item.orgRoot.orgRootShortName}${item.posMasterNo}` // ? `${item.orgRoot.orgRootShortName}${item.posMasterNo}`
: null; // : null;
await new FunctionMain().newSalaryFunction(request, { // await new FunctionMain().newSalaryFunction(request, {
profileId: item.next_holderId, // profileId: item.next_holderId,
date: new Date(), // date: new Date(),
amount: profileSalary?.amount ?? null, // amount: profileSalary?.amount ?? null,
positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null, // positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null,
mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null, // mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null,
posNo: shortName, // posNo: shortName,
position: position?.positionName ?? _null, // position: position?.positionName ?? _null,
positionLine: position?.positionField ?? _null, // positionLine: position?.positionField ?? _null,
positionPathSide: position?.positionArea ?? _null, // positionPathSide: position?.positionArea ?? _null,
positionExecutive: position?.posExecutive?.posExecutiveName ?? _null, // positionExecutive: position?.posExecutive?.posExecutiveName ?? _null,
positionType: position?.posType?.posTypeName ?? _null, // positionType: position?.posType?.posTypeName ?? _null,
positionLevel: position?.posLevel?.posLevelName ?? _null, // positionLevel: position?.posLevel?.posLevelName ?? _null,
refCommandNo: null, // refCommandNo: null,
templateDoc: "ปรับโครงสร้าง", // templateDoc: "ปรับโครงสร้าง",
}); // });
} }
item.current_holderId = item.next_holderId; item.current_holderId = item.next_holderId;
item.next_holderId = null; item.next_holderId = null;

View file

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

View file

@ -1,4 +1,4 @@
import { Controller, Get, Post, Route, Tags, Body, Path, SuccessResponse, Response } from "tsoa"; import { Controller, Get, Post, Route, Tags, Body, Path, Response } from "tsoa";
import { OrgRevision } from "../entities/OrgRevision"; import { OrgRevision } from "../entities/OrgRevision";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
@ -18,12 +18,9 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class OrganizationUnauthorizeController extends Controller { export class OrganizationUnauthorizeController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private orgRootRepository = AppDataSource.getRepository(OrgRoot); private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private profileRepository = AppDataSource.getRepository(Profile);
private profileEmployeeRepository = AppDataSource.getRepository(ProfileEmployee);
/** /**
* API (unauthorize) * API (unauthorize)

View file

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

View file

@ -1,7 +1,6 @@
import { import {
Controller, Controller,
Post, Post,
Put,
Delete, Delete,
Route, Route,
Security, Security,
@ -9,7 +8,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
Query, Query,
@ -18,17 +16,13 @@ import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { Not } from "typeorm";
import { OrgRoot } from "../entities/OrgRoot"; import { OrgRoot } from "../entities/OrgRoot";
import { OrgRevision } from "../entities/OrgRevision"; import { OrgRevision } from "../entities/OrgRevision";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { PermissionOrg } from "../entities/PermissionOrg"; import { PermissionOrg } from "../entities/PermissionOrg";
import { Profile } from "../entities/Profile"; import { Profile } from "../entities/Profile";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";
import permission from "../interfaces/permission";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
@Route("api/v1/org/permission-org") @Route("api/v1/org/permission-org")
@ -38,16 +32,13 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PermissionOrgController extends Controller { export class PermissionOrgController extends Controller {
private orgRootRepository = AppDataSource.getRepository(OrgRoot); private orgRootRepository = AppDataSource.getRepository(OrgRoot);
private profileRepository = AppDataSource.getRepository(Profile); private profileRepository = AppDataSource.getRepository(Profile);
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg); private permissionOrgRepository = AppDataSource.getRepository(PermissionOrg);
private posMasterRepository = AppDataSource.getRepository(PosMaster); private posMasterRepository = AppDataSource.getRepository(PosMaster);
private posMasterEmpRepository = AppDataSource.getRepository(EmployeePosMaster);
private profileRepo = AppDataSource.getRepository(Profile); private profileRepo = AppDataSource.getRepository(Profile);
private profileEmployeeRepo = AppDataSource.getRepository(ProfileEmployee);
/** /**
* API * API
@ -481,7 +472,7 @@ export class PermissionOrgController extends Controller {
_permissionOrg.lastUpdateFullName = request.user.name; _permissionOrg.lastUpdateFullName = request.user.name;
_permissionOrg.createdAt = new Date(); _permissionOrg.createdAt = new Date();
_permissionOrg.lastUpdatedAt = 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 }); setLogDataDiff(request, { before, after: _permissionOrg });
return new HttpSuccess(); return new HttpSuccess();
} }
@ -521,7 +512,7 @@ export class PermissionOrgController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสิทธิ์นี้อยู่ในระบบแล้ว"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบสิทธิ์นี้อยู่ในระบบแล้ว");
} }
await this.permissionOrgRepository.remove(_delPermissionOrg, {data:req}); await this.permissionOrgRepository.remove(_delPermissionOrg, { data: req });
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
Example, Example,
@ -22,7 +21,6 @@ import HttpError from "../interfaces/http-error";
import { CreatePosExecutive, PosExecutive } from "../entities/PosExecutive"; import { CreatePosExecutive, PosExecutive } from "../entities/PosExecutive";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { after } from "node:test";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
@Route("api/v1/org/pos/executive") @Route("api/v1/org/pos/executive")
@Tags("PosExecutive") @Tags("PosExecutive")
@ -31,7 +29,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosExecutiveController extends Controller { export class PosExecutiveController extends Controller {
private posExecutiveRepository = AppDataSource.getRepository(PosExecutive); private posExecutiveRepository = AppDataSource.getRepository(PosExecutive);
private positionRepository = AppDataSource.getRepository(Position); private positionRepository = AppDataSource.getRepository(Position);
@ -85,8 +82,8 @@ export class PosExecutiveController extends Controller {
posExecutive.lastUpdateFullName = request.user.name; posExecutive.lastUpdateFullName = request.user.name;
posExecutive.createdAt = new Date(); posExecutive.createdAt = new Date();
posExecutive.lastUpdatedAt = new Date(); posExecutive.lastUpdatedAt = new Date();
await this.posExecutiveRepository.save(posExecutive, {data: request}); await this.posExecutiveRepository.save(posExecutive, { data: request });
setLogDataDiff(request, {before, after: posExecutive}); setLogDataDiff(request, { before, after: posExecutive });
return new HttpSuccess(posExecutive.id); return new HttpSuccess(posExecutive.id);
} }
@ -147,8 +144,8 @@ export class PosExecutiveController extends Controller {
posExecutive.lastUpdateFullName = request.user.name; posExecutive.lastUpdateFullName = request.user.name;
posExecutive.lastUpdatedAt = new Date(); posExecutive.lastUpdatedAt = new Date();
// this.posExecutiveRepository.merge(posExecutive, requestBody); // this.posExecutiveRepository.merge(posExecutive, requestBody);
await this.posExecutiveRepository.save(posExecutive, {data: request}); await this.posExecutiveRepository.save(posExecutive, { data: request });
setLogDataDiff(request, {before, after: posExecutive}); setLogDataDiff(request, { before, after: posExecutive });
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -4,7 +4,6 @@ import {
Post, Post,
Put, Put,
Delete, Delete,
Patch,
Route, Route,
Security, Security,
Tags, Tags,
@ -12,9 +11,7 @@ import {
Path, Path,
Request, Request,
Example, Example,
SuccessResponse,
Response, Response,
Query,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
@ -31,7 +28,6 @@ import { Not } from "typeorm";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosLevelController extends Controller { export class PosLevelController extends Controller {
private posTypeRepository = AppDataSource.getRepository(PosType); private posTypeRepository = AppDataSource.getRepository(PosType);
private posLevelRepository = AppDataSource.getRepository(PosLevel); private posLevelRepository = AppDataSource.getRepository(PosLevel);

View file

@ -9,13 +9,11 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import { PosLevel, CreatePosLevel } from "../entities/PosLevel";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { PosMasterAct } from "../entities/PosMasterAct"; import { PosMasterAct } from "../entities/PosMasterAct";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
@ -30,7 +28,6 @@ import Extension from "../interfaces/extension";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosMasterActController extends Controller { export class PosMasterActController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct); private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);

View file

@ -4,7 +4,6 @@ import {
Post, Post,
Put, Put,
Delete, Delete,
Patch,
Route, Route,
Security, Security,
Tags, Tags,
@ -12,9 +11,7 @@ import {
Path, Path,
Request, Request,
Example, Example,
SuccessResponse,
Response, Response,
Query,
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
@ -33,10 +30,8 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PosTypeController extends Controller { export class PosTypeController extends Controller {
private posTypeRepository = AppDataSource.getRepository(PosType); private posTypeRepository = AppDataSource.getRepository(PosType);
private posLevelRepository = AppDataSource.getRepository(PosLevel);
/** /**
* API * API
@ -73,8 +68,8 @@ export class PosTypeController extends Controller {
posType.lastUpdateFullName = request.user.name; posType.lastUpdateFullName = request.user.name;
posType.createdAt = new Date(); posType.createdAt = new Date();
posType.lastUpdatedAt = new Date(); posType.lastUpdatedAt = new Date();
await this.posTypeRepository.save(posType, {data: request}); await this.posTypeRepository.save(posType, { data: request });
setLogDataDiff(request, {before , after: posType}); setLogDataDiff(request, { before, after: posType });
return new HttpSuccess(posType); return new HttpSuccess(posType);
} }
@ -113,8 +108,8 @@ export class PosTypeController extends Controller {
posType.lastUpdateFullName = request.user.name; posType.lastUpdateFullName = request.user.name;
posType.lastUpdatedAt = new Date(); posType.lastUpdatedAt = new Date();
this.posTypeRepository.merge(posType, requestBody); this.posTypeRepository.merge(posType, requestBody);
await this.posTypeRepository.save(posType, {data: request}); await this.posTypeRepository.save(posType, { data: request });
setLogDataDiff(request,{ before, after:posType }); setLogDataDiff(request, { before, after: posType });
return new HttpSuccess(posType.id); return new HttpSuccess(posType.id);
} }
@ -130,10 +125,10 @@ export class PosTypeController extends Controller {
let result: any; let result: any;
try { try {
result = await this.posTypeRepository.findOne({ where: { id } }); result = await this.posTypeRepository.findOne({ where: { id } });
if(!result){ if (!result) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
} }
await this.posTypeRepository.remove(result, {data: result}); await this.posTypeRepository.remove(result, { data: result });
} catch { } catch {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,

View file

@ -4,7 +4,6 @@ import {
Post, Post,
Put, Put,
Delete, Delete,
Patch,
Route, Route,
Security, Security,
Tags, Tags,
@ -12,7 +11,6 @@ import {
Path, Path,
Request, Request,
Example, Example,
SuccessResponse,
Response, Response,
Query, Query,
} from "tsoa"; } from "tsoa";
@ -24,7 +22,7 @@ import { PosType } from "../entities/PosType";
import { PosLevel } from "../entities/PosLevel"; import { PosLevel } from "../entities/PosLevel";
import { CreatePosDict, CreatePosDictExe, PosDict, UpdatePosDict } from "../entities/PosDict"; import { CreatePosDict, CreatePosDictExe, PosDict, UpdatePosDict } from "../entities/PosDict";
import HttpError from "../interfaces/http-error"; 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 { CreatePosMaster, PosMaster } from "../entities/PosMaster";
import { OrgRevision } from "../entities/OrgRevision"; import { OrgRevision } from "../entities/OrgRevision";
import { OrgRoot } from "../entities/OrgRoot"; import { OrgRoot } from "../entities/OrgRoot";
@ -40,10 +38,8 @@ import { EmployeePosLevel } from "../entities/EmployeePosLevel";
import { AuthRole } from "../entities/AuthRole"; import { AuthRole } from "../entities/AuthRole";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { request } from "axios";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
import { PosMasterAssign } from "../entities/PosMasterAssign"; import { PosMasterAssign } from "../entities/PosMasterAssign";
import { CommandSys } from "../entities/CommandSys";
import { Assign } from "../entities/Assign"; import { Assign } from "../entities/Assign";
@Route("api/v1/org/pos") @Route("api/v1/org/pos")
@Tags("Position") @Tags("Position")
@ -52,7 +48,6 @@ import { Assign } from "../entities/Assign";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PositionController extends Controller { export class PositionController extends Controller {
private posExecutiveRepository = AppDataSource.getRepository(PosExecutive); private posExecutiveRepository = AppDataSource.getRepository(PosExecutive);
private posTypeRepository = AppDataSource.getRepository(PosType); private posTypeRepository = AppDataSource.getRepository(PosType);
@ -151,7 +146,7 @@ export class PositionController extends Controller {
posDict.lastUpdateFullName = request.user.name; posDict.lastUpdateFullName = request.user.name;
posDict.createdAt = new Date(); posDict.createdAt = new Date();
posDict.lastUpdatedAt = 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 }); setLogDataDiff(request, { before, after: posDict });
return new HttpSuccess(posDict.id); return new HttpSuccess(posDict.id);
} }
@ -223,7 +218,7 @@ export class PositionController extends Controller {
where: { posMasterId: posMaster.id }, where: { posMasterId: posMaster.id },
}); });
if (posMasterAssigns.length > 0) { 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 }); // await this.posMasterAssignRepo.delete({ posMasterId: posMaster.id });
return new HttpSuccess(); return new HttpSuccess();
@ -307,8 +302,8 @@ export class PositionController extends Controller {
posExecutive.lastUpdateFullName = request.user.name; posExecutive.lastUpdateFullName = request.user.name;
posExecutive.createdAt = new Date(); posExecutive.createdAt = new Date();
posExecutive.lastUpdatedAt = new Date(); posExecutive.lastUpdatedAt = new Date();
await this.posExecutiveRepository.save(posExecutive, {data:request}); await this.posExecutiveRepository.save(posExecutive, { data: request });
setLogDataDiff(request, {before, after: posExecutive}); setLogDataDiff(request, { before, after: posExecutive });
} }
const rowRepeated = await this.posDictRepository.findOne({ const rowRepeated = await this.posDictRepository.findOne({
@ -334,8 +329,8 @@ export class PositionController extends Controller {
posDict.lastUpdateFullName = request.user.name; posDict.lastUpdateFullName = request.user.name;
posDict.createdAt = new Date(); posDict.createdAt = new Date();
posDict.lastUpdatedAt = 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}); setLogDataDiff(request, { before, after: posDict });
return new HttpSuccess(posDict.id); return new HttpSuccess(posDict.id);
} }
@ -433,8 +428,8 @@ export class PositionController extends Controller {
posDict.posDictArea = requestBody.posDictArea ? requestBody.posDictArea : ""; posDict.posDictArea = requestBody.posDictArea ? requestBody.posDictArea : "";
posDict.isSpecial = requestBody.isSpecial; posDict.isSpecial = requestBody.isSpecial;
// this.posDictRepository.merge(posDict, requestBody); // this.posDictRepository.merge(posDict, requestBody);
await this.posDictRepository.save(posDict, {data:request}); await this.posDictRepository.save(posDict, { data: request });
setLogDataDiff(request, {before, after: posDict}); setLogDataDiff(request, { before, after: posDict });
return new HttpSuccess(); return new HttpSuccess();
} }
@ -452,7 +447,7 @@ export class PositionController extends Controller {
if (!delPosDict) { if (!delPosDict) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้");
} }
await this.posDictRepository.remove(delPosDict, {data: request}); await this.posDictRepository.remove(delPosDict, { data: request });
return new HttpSuccess(); return new HttpSuccess();
} }
@ -4053,4 +4048,113 @@ export class PositionController extends Controller {
} }
return new HttpSuccess(); 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);
}
} }

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -21,7 +20,6 @@ import { Prefixe, CreatePrefixe, UpdatePrefixe } from "../entities/Prefixe";
import { Not } from "typeorm"; import { Not } from "typeorm";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { request } from "axios";
@Route("api/v1/org/metadata/prefix") @Route("api/v1/org/metadata/prefix")
@Tags("Prefix") @Tags("Prefix")
@ -30,7 +28,6 @@ import { request } from "axios";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class PrefixController extends Controller { export class PrefixController extends Controller {
private prefixRepository = AppDataSource.getRepository(Prefixe); private prefixRepository = AppDataSource.getRepository(Prefixe);

View file

@ -20,6 +20,7 @@ import { Profile } from "../entities/Profile";
import { CreateProfileEdit, EditProfileEdit, ProfileEdit } from "../entities/ProfileEdit"; import { CreateProfileEdit, EditProfileEdit, ProfileEdit } from "../entities/ProfileEdit";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { Brackets } from "typeorm"; import { Brackets } from "typeorm";
import CallAPI from "../interfaces/call-api";
@Route("api/v1/org/profile/edit") @Route("api/v1/org/profile/edit")
@Tags("ProfileEdit") @Tags("ProfileEdit")
@ -184,7 +185,10 @@ export class ProfileEditController extends Controller {
@Post() @Post()
public async newProfileEdit(@Request() req: RequestWithUser, @Body() body: CreateProfileEdit) { 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) { if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
} }
@ -203,6 +207,17 @@ export class ProfileEditController extends Controller {
data.status = "PENDING"; data.status = "PENDING";
await this.profileEditRepo.save(data); 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); return new HttpSuccess(data.id);
} }

View file

@ -62,7 +62,6 @@ import {
} from "../entities/ProfileEmployeeEmployment"; } from "../entities/ProfileEmployeeEmployment";
import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory"; import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory";
import CallAPI from "../interfaces/call-api"; import CallAPI from "../interfaces/call-api";
import { EmployeePosition } from "../entities/EmployeePosition";
import { ProfileInsignia } from "../entities/ProfileInsignia"; import { ProfileInsignia } from "../entities/ProfileInsignia";
import { ProfileLeave } from "../entities/ProfileLeave"; import { ProfileLeave } from "../entities/ProfileLeave";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,16 +1,4 @@
import { import { Body, Controller, Get, Patch, Path, Post, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";

View file

@ -1,28 +1,11 @@
import { import { Body, Controller, Example, Get, Patch, Path, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Delete,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { ProfileEmployee } from "../entities/ProfileEmployee"; import { ProfileEmployee } from "../entities/ProfileEmployee";
import { import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
CreateProfileEmployeeGovernment,
ProfileGovernment,
UpdateProfileGovernment,
} from "../entities/ProfileGovernment";
import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosition } from "../entities/EmployeePosition";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils"; import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";

View file

@ -1,28 +1,11 @@
import { import { Body, Controller, Example, Get, Patch, Path, Request, Route, Security, Tags } from "tsoa";
Body,
Controller,
Example,
Get,
Patch,
Path,
Delete,
Post,
Request,
Route,
Security,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { ProfileEmployee } from "../entities/ProfileEmployee"; import { ProfileEmployee } from "../entities/ProfileEmployee";
import { import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
CreateProfileEmployeeGovernment,
ProfileGovernment,
UpdateProfileGovernment,
} from "../entities/ProfileGovernment";
import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosition } from "../entities/EmployeePosition";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils"; import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";

View file

@ -2,7 +2,6 @@ import {
Body, Body,
Controller, Controller,
Delete, Delete,
Example,
Get, Get,
Patch, Patch,
Path, Path,

View file

@ -2,7 +2,6 @@ import {
Body, Body,
Controller, Controller,
Delete, Delete,
Example,
Get, Get,
Patch, Patch,
Path, Path,

View file

@ -2,7 +2,6 @@ import {
Body, Body,
Controller, Controller,
Delete, Delete,
Example,
Get, Get,
Patch, Patch,
Path, Path,

View file

@ -2,7 +2,6 @@ import {
Body, Body,
Controller, Controller,
Delete, Delete,
Example,
Get, Get,
Patch, Patch,
Path, Path,

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -29,7 +28,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ProvinceController extends Controller { export class ProvinceController extends Controller {
private provinceRepository = AppDataSource.getRepository(Province); private provinceRepository = AppDataSource.getRepository(Province);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -28,7 +27,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class RankController extends Controller { export class RankController extends Controller {
private rankRepository = AppDataSource.getRepository(Rank); private rankRepository = AppDataSource.getRepository(Rank);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -21,7 +20,6 @@ import { CreateRelationship, Relationship } from "../entities/Relationship";
import { Not } from "typeorm"; import { Not } from "typeorm";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import { setLogDataDiff } from "../interfaces/utils"; import { setLogDataDiff } from "../interfaces/utils";
import { request } from "axios";
@Route("api/v1/org/metadata/relationship") @Route("api/v1/org/metadata/relationship")
@Tags("Relationship") @Tags("Relationship")
@Security("bearerAuth") @Security("bearerAuth")
@ -29,7 +27,6 @@ import { request } from "axios";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class RelationshipController extends Controller { export class RelationshipController extends Controller {
private relationshipRepository = AppDataSource.getRepository(Relationship); private relationshipRepository = AppDataSource.getRepository(Relationship);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -28,7 +27,6 @@ import { RequestWithUser } from "../middlewares/user";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ReligionController extends Controller { export class ReligionController extends Controller {
private religionRepository = AppDataSource.getRepository(Religion); private religionRepository = AppDataSource.getRepository(Religion);

View file

@ -18,7 +18,6 @@ import Extension from "../interfaces/extension";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ReportController extends Controller { export class ReportController extends Controller {
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision); private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
private orgRootRepository = AppDataSource.getRepository(OrgRoot); private orgRootRepository = AppDataSource.getRepository(OrgRoot);

View file

@ -9,7 +9,6 @@ import {
Body, Body,
Path, Path,
Request, Request,
SuccessResponse,
Response, Response,
Get, Get,
} from "tsoa"; } from "tsoa";
@ -30,7 +29,6 @@ import { setLogDataDiff } from "../interfaces/utils";
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
) )
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class SubDistrictController extends Controller { export class SubDistrictController extends Controller {
private subDistrictRepository = AppDataSource.getRepository(SubDistrict); private subDistrictRepository = AppDataSource.getRepository(SubDistrict);
private districtRepository = AppDataSource.getRepository(District); private districtRepository = AppDataSource.getRepository(District);

View file

@ -30,15 +30,11 @@ import {
getRoleMappings, getRoleMappings,
getUserCount, getUserCount,
enableStatus, enableStatus,
getUserCountOrg,
getUserListOrg,
} from "../keycloak"; } from "../keycloak";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import { Profile } from "../entities/Profile"; import { Profile } from "../entities/Profile";
import { ProfileEmployee } from "../entities/ProfileEmployee"; import { ProfileEmployee } from "../entities/ProfileEmployee";
import { IsNull, Not } from "typeorm";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission";
// import * as io from "../lib/websocket"; // import * as io from "../lib/websocket";
// import elasticsearch from "../elasticsearch"; // import elasticsearch from "../elasticsearch";
// import { StorageFolder } from "../interfaces/storage-fs"; // import { StorageFolder } from "../interfaces/storage-fs";

View file

@ -263,26 +263,31 @@ export class WorkflowController extends Controller {
}, },
relations: ["workflow"], relations: ["workflow"],
}); });
if (!stateOperatorUser) const workflow = await this.workflowRepo.findOne({
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้"); where: {
refId: body.refId,
sysName: body.system,
},
});
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
const operator = await this.stateOperatorRepo.findOne({ const operator = await this.stateOperatorRepo.findOne({
where: { where: {
operator: stateOperatorUser.operator, operator: stateOperatorUser?.operator || "",
stateId: stateOperatorUser.workflow.stateId, stateId: workflow.stateId,
}, },
relations: ["state"], relations: ["state"],
}); });
if (!operator) { if (!operator) {
const state = await this.stateRepo.findOne({ const state = await this.stateRepo.findOne({
where: { where: {
id: stateOperatorUser.workflow.stateId, id: workflow.stateId,
}, },
}); });
return new HttpSuccess({ return new HttpSuccess({
stateId: state?.id || null, stateId: state?.id || null,
stateNo: state?.order || null, stateNo: state?.order || null,
stateName: state?.name || null, stateName: state?.name || null,
operator: stateOperatorUser.operator, operator: stateOperatorUser?.operator || null,
can_view: false, can_view: false,
can_update: false, can_update: false,
can_operate: false, can_operate: false,
@ -333,6 +338,7 @@ export class WorkflowController extends Controller {
prefix: x.profile.prefix, prefix: x.profile.prefix,
firstName: x.profile.firstName, firstName: x.profile.firstName,
lastName: x.profile.lastName, lastName: x.profile.lastName,
isComment: x.profile.keycloak == req.user.sub ? true : false,
profileId: x.profileId, profileId: x.profileId,
isAcceptSetting: x.isAcceptSetting, isAcceptSetting: x.isAcceptSetting,
isApproveSetting: x.isApproveSetting, isApproveSetting: x.isApproveSetting,
@ -540,34 +546,23 @@ export class WorkflowController extends Controller {
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
@Body() @Body()
body: { body: {
stateId: string; stateUserCommentId: string;
isAccept?: boolean | null; isAccept?: boolean | null;
isApprove?: boolean | null; isApprove?: boolean | null;
reason?: string | null; reason?: string | null;
}, },
) { ) {
const profile = await this.profileRepo.findOne({ const stateUserComment = await this.stateUserCommentRepo.findOne({
where: { where: {
keycloak: req.user.sub, id: body.stateUserCommentId,
}, },
}); });
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน"); if (!stateUserComment)
const state = await this.stateRepo.findOne({ throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
where: {
id: body.stateId,
},
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
let _null: any = null; 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.isAccept = body.isAccept == null ? _null : body.isAccept;
stateUserComment.isApprove = body.isApprove == null ? _null : body.isAccept; stateUserComment.isApprove = body.isApprove == null ? _null : body.isApprove;
stateUserComment.reason = body.reason == null ? _null : body.isAccept; stateUserComment.reason = body.reason == null ? _null : body.reason;
stateUserComment.createdUserId = req.user.sub;
stateUserComment.createdFullName = req.user.name;
stateUserComment.createdAt = new Date();
stateUserComment.lastUpdateUserId = req.user.sub; stateUserComment.lastUpdateUserId = req.user.sub;
stateUserComment.lastUpdateFullName = req.user.name; stateUserComment.lastUpdateFullName = req.user.name;
stateUserComment.lastUpdatedAt = new Date(); stateUserComment.lastUpdatedAt = new Date();
@ -614,6 +609,7 @@ export class WorkflowController extends Controller {
}); });
return new HttpSuccess({ return new HttpSuccess({
id: stateUserComment?.id || null,
isAccept: stateUserComment?.isAccept || null, isAccept: stateUserComment?.isAccept || null,
isApprove: stateUserComment?.isApprove || null, isApprove: stateUserComment?.isApprove || null,
reason: stateUserComment?.reason || null, reason: stateUserComment?.reason || null,

View file

@ -8,7 +8,6 @@ import {
ManyToOne, ManyToOne,
JoinColumn, JoinColumn,
} from "typeorm"; } from "typeorm";
import { CommandType } from "./CommandType";
import { PosMasterAssign } from "./PosMasterAssign"; import { PosMasterAssign } from "./PosMasterAssign";
import { CommandSys } from "./CommandSys"; import { CommandSys } from "./CommandSys";

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne } from "typeorm"; import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { AuthRoleAttr } from "./AuthRoleAttr"; import { AuthRoleAttr } from "./AuthRoleAttr";
import { PosMaster } from "./PosMaster"; import { PosMaster } from "./PosMaster";

View file

@ -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 { EntityBase } from "./base/Base";
import { AuthSys } from "./AuthSys"; import { AuthSys } from "./AuthSys";
import { AuthRole } from "./AuthRole"; import { AuthRole } from "./AuthRole";

View file

@ -1,7 +1,5 @@
import { Entity, Column, OneToMany } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
@Entity("bloodGroup") @Entity("bloodGroup")
export class BloodGroup extends EntityBase { export class BloodGroup extends EntityBase {

View file

@ -1,4 +1,4 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { ProfileChangePosition } from "./ProfileChangePosition"; import { ProfileChangePosition } from "./ProfileChangePosition";

View file

@ -4,6 +4,7 @@ import { CommandType } from "./CommandType";
import { CommandSend } from "./CommandSend"; import { CommandSend } from "./CommandSend";
import { CommandSalary } from "./CommandSalary"; import { CommandSalary } from "./CommandSalary";
import { CommandRecive } from "./CommandRecive"; import { CommandRecive } from "./CommandRecive";
import { ProfileSalary } from "./ProfileSalary";
@Entity("command") @Entity("command")
export class Command extends EntityBase { export class Command extends EntityBase {
@ -151,6 +152,9 @@ export class Command extends EntityBase {
@OneToMany(() => CommandRecive, (commandRecive) => commandRecive.command) @OneToMany(() => CommandRecive, (commandRecive) => commandRecive.command)
commandRecives: CommandRecive[]; commandRecives: CommandRecive[];
@OneToMany(() => ProfileSalary, (profileSalary) => profileSalary.command)
profileSalarys: ProfileSalary[];
} }
export class CreateCommand { export class CreateCommand {

View file

@ -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 { EntityBase } from "./base/Base";
import { Command } from "./Command"; import { Command } from "./Command";

View file

@ -9,7 +9,6 @@ import {
import { CommandType } from "./CommandType"; import { CommandType } from "./CommandType";
import { CommandSalary } from "./CommandSalary"; import { CommandSalary } from "./CommandSalary";
import { Assign } from "./Assign"; import { Assign } from "./Assign";
import { Workflow } from "./Workflow";
@Entity("commandSys") @Entity("commandSys")
export class CommandSys { export class CommandSys {

View file

@ -1,7 +1,5 @@
import { Entity, Column, OneToMany } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
@Entity("gender") @Entity("gender")
export class Gender extends EntityBase { export class Gender extends EntityBase {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_EDUCATION") @Entity("HR_EDUCATION")
export class HR_EDUCATION { export class HR_EDUCATION {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_EDUCATION_EMP") @Entity("HR_EDUCATION_EMP")
export class HR_EDUCATION_EMP { export class HR_EDUCATION_EMP {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_PERSONAL_EMP_ADDRESS") @Entity("HR_PERSONAL_EMP_ADDRESS")
export class HR_PERSONAL_EMP_ADDRESS { export class HR_PERSONAL_EMP_ADDRESS {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_PERSONAL_EMP_FAMILY") @Entity("HR_PERSONAL_EMP_FAMILY")
export class HR_PERSONAL_EMP_FAMILY { export class HR_PERSONAL_EMP_FAMILY {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_PERSONAL_OFFICER_ADDRESS") @Entity("HR_PERSONAL_OFFICER_ADDRESS")
export class HR_PERSONAL_OFFICER_ADDRESS { export class HR_PERSONAL_OFFICER_ADDRESS {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_PERSONAL_OFFICER_FAMILY") @Entity("HR_PERSONAL_OFFICER_FAMILY")
export class HR_PERSONAL_OFFICER_FAMILY { export class HR_PERSONAL_OFFICER_FAMILY {

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, PrimaryGeneratedColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_POSITION_OFFICER") @Entity("HR_POSITION_OFFICER")
export class HR_POSITION_OFFICER { export class HR_POSITION_OFFICER {

View file

@ -1,6 +1,5 @@
import { Entity, Column, OneToMany } from "typeorm"; import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { ProfileLeave } from "./ProfileLeave"; import { ProfileLeave } from "./ProfileLeave";
@Entity("leaveType") @Entity("leaveType")

View file

@ -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 { EntityBase } from "./base/Base";
import { MetaState } from "./MetaState"; import { MetaState } from "./MetaState";

View file

@ -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 { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot"; import { OrgRoot } from "./OrgRoot";
import { OrgChild2 } from "./OrgChild2"; import { OrgChild2 } from "./OrgChild2";

View file

@ -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 { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot"; import { OrgRoot } from "./OrgRoot";
import { OrgChild1 } from "./OrgChild1"; import { OrgChild1 } from "./OrgChild1";

View file

@ -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 { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot"; import { OrgRoot } from "./OrgRoot";
import { OrgChild1 } from "./OrgChild1"; import { OrgChild1 } from "./OrgChild1";

View file

@ -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 { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot"; import { OrgRoot } from "./OrgRoot";
import { PosMaster } from "./PosMaster"; import { PosMaster } from "./PosMaster";

View file

@ -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 { EntityBase } from "./base/Base";
import { OrgChild1 } from "./OrgChild1"; import { OrgChild1 } from "./OrgChild1";
import { OrgRevision } from "./OrgRevision"; import { OrgRevision } from "./OrgRevision";
@ -6,7 +6,6 @@ import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3"; import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4"; import { OrgChild4 } from "./OrgChild4";
import { PosMaster } from "./PosMaster"; import { PosMaster } from "./PosMaster";
import { Profile } from "./Profile";
import { PermissionOrg } from "./PermissionOrg"; import { PermissionOrg } from "./PermissionOrg";
enum OrgRootRank { enum OrgRootRank {

View file

@ -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 { EntityBase } from "./base/Base";
import { PosExecutive } from "./PosExecutive"; import { PosExecutive } from "./PosExecutive";
import { PosType } from "./PosType"; import { PosType } from "./PosType";

View file

@ -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 { EntityBase } from "./base/Base";
import { Position } from "./Position"; import { Position } from "./Position";
import { PosDict } from "./PosDict"; import { PosDict } from "./PosDict";

View file

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

View file

@ -195,6 +195,13 @@ export class PosMaster extends EntityBase {
}) })
authRoleId: string; authRoleId: string;
@Column({
comment: "สถานะออกคำสั่ง",
default: "PENDING",
length: 20,
})
statusReport: string;
@ManyToOne(() => AuthRole, (authRole) => authRole.posMasters) @ManyToOne(() => AuthRole, (authRole) => authRole.posMasters)
@JoinColumn({ name: "authRoleId" }) @JoinColumn({ name: "authRoleId" })
authRole: AuthRole; authRole: AuthRole;

View file

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

View file

@ -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 { EntityBase } from "./base/Base";
import { PosMaster } from "./PosMaster"; import { PosMaster } from "./PosMaster";
import { PosLevel } from "./PosLevel"; import { PosLevel } from "./PosLevel";

View file

@ -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 { EntityBase } from "./base/Base";
import { PosMaster } from "./PosMaster"; import { PosMaster } from "./PosMaster";
import { PosLevel } from "./PosLevel"; import { PosLevel } from "./PosLevel";

View file

@ -1,6 +1,5 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileAbility } from "./ProfileAbility"; import { ProfileAbility } from "./ProfileAbility";
@Entity("profileAbilityHistory") @Entity("profileAbilityHistory")

View file

@ -1,6 +1,5 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileAssessment } from "./ProfileAssessment"; import { ProfileAssessment } from "./ProfileAssessment";
@Entity("profileAssessmentHistory") @Entity("profileAssessmentHistory")

View file

@ -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 { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileCertificate } from "./ProfileCertificate"; import { ProfileCertificate } from "./ProfileCertificate";
@Entity("profileCertificateHistory") @Entity("profileCertificateHistory")

View file

@ -1,6 +1,5 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory"; import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
import { ProfileEmployee } from "./ProfileEmployee"; import { ProfileEmployee } from "./ProfileEmployee";
// import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory"; // import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";

View file

@ -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 { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileChangeName } from "./ProfileChangeName"; import { ProfileChangeName } from "./ProfileChangeName";
@Entity("profileChangeNameHistory") @Entity("profileChangeNameHistory")

View file

@ -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 { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileChildren } from "./ProfileChildren"; import { ProfileChildren } from "./ProfileChildren";
@Entity("profileChildrenHistory") @Entity("profileChildrenHistory")

View file

@ -1,6 +1,5 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileDiscipline } from "./ProfileDiscipline"; import { ProfileDiscipline } from "./ProfileDiscipline";
@Entity("profileDisciplineHistory") @Entity("profileDisciplineHistory")

View file

@ -1,6 +1,5 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileDuty } from "./ProfileDuty"; import { ProfileDuty } from "./ProfileDuty";
@Entity("profileDutyHistory") @Entity("profileDutyHistory")

View file

@ -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 { EntityBase } from "./base/Base";
import { Profile } from "./Profile"; import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee"; import { ProfileEmployee } from "./ProfileEmployee";

View file

@ -1,6 +1,5 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEducation } from "./ProfileEducation"; import { ProfileEducation } from "./ProfileEducation";
@Entity("profileEducationHistory") @Entity("profileEducationHistory")

View file

@ -24,7 +24,7 @@ import { ProfileFamilyFather } from "./ProfileFamilyFather";
import { ProfileFamilyMother } from "./ProfileFamilyMother"; import { ProfileFamilyMother } from "./ProfileFamilyMother";
import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; import { ProfileFamilyCouple } from "./ProfileFamilyCouple";
import { ProfileChildren } from "./ProfileChildren"; import { ProfileChildren } from "./ProfileChildren";
import { Profile, ProfileAddressHistory } from "./Profile"; import { ProfileAddressHistory } from "./Profile";
import { Province } from "./Province"; import { Province } from "./Province";
import { District } from "./District"; import { District } from "./District";
import { SubDistrict } from "./SubDistrict"; import { SubDistrict } from "./SubDistrict";

View file

@ -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 { EntityBase } from "./base/Base";
import { Profile } from "./Profile"; import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee"; import { ProfileEmployee } from "./ProfileEmployee";

View file

@ -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 { EntityBase } from "./base/Base";
import { ProfileFamilyCouple } from "./ProfileFamilyCouple"; import { ProfileFamilyCouple } from "./ProfileFamilyCouple";

Some files were not shown because too many files have changed in this diff Show more