Merge branch 'develop'
This commit is contained in:
commit
640d5ad473
11 changed files with 649 additions and 126 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
downloadFile,
|
||||
listFile,
|
||||
updateFile,
|
||||
updateFile2
|
||||
} from "../services/storage";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { Evaluation } from "../entities/Evaluation";
|
||||
|
|
@ -221,7 +222,7 @@ export class DocumentController extends Controller {
|
|||
throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์ ไม่สามารถสร้างแฟ้มได้");
|
||||
}
|
||||
|
||||
let used: string[] = [];
|
||||
// let used: string[] = [];
|
||||
|
||||
const evaluation = AppDataSource.getRepository(Evaluation);
|
||||
|
||||
|
|
@ -230,20 +231,45 @@ export class DocumentController extends Controller {
|
|||
});
|
||||
|
||||
let fileList = !body.replace
|
||||
? body.fileList.map(({ fileName, ...props }) => {
|
||||
? await Promise.all(body.fileList.map(async({ fileName, ...props }) => {
|
||||
const dotIndex = fileName.lastIndexOf(".");
|
||||
const originalName =
|
||||
dotIndex !== -1 && !fileName.startsWith(".") ? fileName.slice(0, dotIndex) : fileName;
|
||||
const extension =
|
||||
dotIndex !== -1 && !fileName.startsWith(".") ? fileName.slice(dotIndex) : "";
|
||||
|
||||
let i = 1;
|
||||
// let i = 1;
|
||||
let copyFileName = fileName;
|
||||
while (
|
||||
list.findIndex((v) => v.fileName === fileName) !== -1 ||
|
||||
used.includes(fileName)
|
||||
list.findIndex((v) => v.fileName === fileName) !== -1 /*||
|
||||
used.includes(fileName)*/
|
||||
) {
|
||||
fileName = `${originalName} (${i++})`;
|
||||
if (dotIndex !== -1) fileName += extension;
|
||||
// fileName = `${originalName} (${i++})`;
|
||||
// if (dotIndex !== -1) fileName += extension;
|
||||
let copy = 0;
|
||||
while (
|
||||
list.findIndex(
|
||||
(v) =>
|
||||
v.fileName ===
|
||||
`${originalName} (${copy + 1})` + (dotIndex !== -1 ? extension : ""),
|
||||
) !== -1
|
||||
) {
|
||||
copy++;
|
||||
}
|
||||
copyFileName = `${originalName} (${copy + 1})` + extension;
|
||||
|
||||
const result = await updateFile2(
|
||||
["ระบบประเมิน", volume, id],
|
||||
fileName,
|
||||
{ ...props, title: copyFileName },
|
||||
["ระบบประเมิน", volume, id],
|
||||
copyFileName,
|
||||
);
|
||||
|
||||
if (!result) {
|
||||
throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์ ไม่สามารถแก้ไขไฟล์ได้");
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (author) {
|
||||
props.author = `${author.prefix}${author.fullName}`;
|
||||
|
|
@ -251,9 +277,9 @@ export class DocumentController extends Controller {
|
|||
props.author = "ไม่พบข้อมูล";
|
||||
}
|
||||
|
||||
used.push(fileName);
|
||||
// used.push(fileName);
|
||||
return { fileName: fileName, ...props };
|
||||
})
|
||||
}))
|
||||
: body.fileList;
|
||||
|
||||
const map = fileList.map(async ({ fileName, ...props }) => [
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import CallAPI from "../interfaces/call-api";
|
|||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
import Extension from "../interfaces/extension";
|
||||
|
||||
@Route("api/v1/evaluation")
|
||||
@Tags("evaluation")
|
||||
|
|
@ -519,31 +520,78 @@ export class EvaluationController {
|
|||
});
|
||||
|
||||
//Salary
|
||||
if (requestBody.salaries != null)
|
||||
// if (requestBody.salaries != null)
|
||||
// requestBody.salaries.forEach(async (salary) => {
|
||||
// const salaries = new Salary();
|
||||
// salaries.createdUserId = request.user.sub;
|
||||
// salaries.createdFullName = request.user.name;
|
||||
// salaries.createdAt = new Date();
|
||||
// salaries.lastUpdateUserId = request.user.sub;
|
||||
// salaries.lastUpdateFullName = request.user.name;
|
||||
// salaries.lastUpdatedAt = new Date();
|
||||
// salaries.date = salary.date ?? _null;
|
||||
// salaries.amount = salary.amount ?? _null;
|
||||
// salaries.positionSalaryAmount = salary.positionSalaryAmount ?? _null;
|
||||
// salaries.mouthSalaryAmount = salary.mouthSalaryAmount ?? _null;
|
||||
// salaries.position = salary.position ?? _null;
|
||||
// salaries.posNo = salary.posNo ?? _null;
|
||||
// salaries.salaryClass = salary.salaryClass ?? _null;
|
||||
// salaries.salaryRef = salary.salaryRef ?? _null;
|
||||
// salaries.refCommandNo = salary.refCommandNo ?? _null;
|
||||
// salaries.refCommandDate = salary.refCommandDate ?? _null;
|
||||
// salaries.salaryStatus = salary.salaryStatus ?? _null;
|
||||
// salaries.evaluation = evaluation;
|
||||
// await this.salaryRepository.save(salaries, { data: request });
|
||||
// setLogDataDiff(request, { before, after: salaries });
|
||||
// });
|
||||
|
||||
if (requestBody.salaries != null) {
|
||||
requestBody.salaries.forEach(async (salary) => {
|
||||
const salaries = new Salary();
|
||||
salaries.profileId = salary.profileId ?? _null;
|
||||
salaries.commandCode = salary.commandCode ?? _null;
|
||||
salaries.commandNo = salary.commandNo ?? _null;
|
||||
salaries.commandYear = salary.commandYear ?? _null;
|
||||
salaries.commandDateAffect = salary.commandDateAffect ?? _null;
|
||||
salaries.commandDateSign = salary.commandDateSign ?? _null;
|
||||
salaries.posNoAbb = salary.posNoAbb ?? _null;
|
||||
salaries.posNo = salary.posNo ?? _null;
|
||||
salaries.positionName = salary.positionName ?? _null;
|
||||
salaries.positionType = salary.positionType ?? _null;
|
||||
salaries.positionLevel = salary.positionLevel ?? _null;
|
||||
salaries.positionLine = salary.positionLine ?? _null;
|
||||
salaries.positionPathSide = salary.positionPathSide ?? _null;
|
||||
salaries.positionExecutive = salary.positionExecutive ?? _null;
|
||||
salaries.amount = salary.amount ?? _null;
|
||||
salaries.amountSpecial = salary.amountSpecial ?? _null;
|
||||
salaries.positionSalaryAmount = salary.positionSalaryAmount ?? _null;
|
||||
salaries.mouthSalaryAmount = salary.mouthSalaryAmount ?? _null;
|
||||
salaries.orgRoot = salary.orgRoot ?? _null;
|
||||
salaries.orgChild1 = salary.orgChild1 ?? _null;
|
||||
salaries.orgChild2 = salary.orgChild2 ?? _null;
|
||||
salaries.orgChild3 = salary.orgChild3 ?? _null;
|
||||
salaries.orgChild4 = salary.orgChild4 ?? _null;
|
||||
salaries.remark = salary.remark ?? _null;
|
||||
salaries.commandId = salary.commandId ?? _null;
|
||||
salaries.isGovernment = salary.isGovernment ?? _null;
|
||||
salaries.positionCee = salary.positionCee ?? _null;
|
||||
salaries.commandName = salary.commandName ?? _null;
|
||||
salaries.posNumCodeSit = salary.posNumCodeSit ?? _null;
|
||||
salaries.posNumCodeSitAbb = salary.posNumCodeSitAbb ?? _null;
|
||||
salaries.isEntry = salary.isEntry ?? false;
|
||||
salaries.evaluation = evaluation;
|
||||
|
||||
salaries.createdUserId = request.user.sub;
|
||||
salaries.createdFullName = request.user.name;
|
||||
salaries.createdAt = new Date();
|
||||
salaries.lastUpdateUserId = request.user.sub;
|
||||
salaries.lastUpdateFullName = request.user.name;
|
||||
salaries.lastUpdatedAt = new Date();
|
||||
salaries.date = salary.date ?? _null;
|
||||
salaries.amount = salary.amount ?? _null;
|
||||
salaries.positionSalaryAmount = salary.positionSalaryAmount ?? _null;
|
||||
salaries.mouthSalaryAmount = salary.mouthSalaryAmount ?? _null;
|
||||
salaries.position = salary.position ?? _null;
|
||||
salaries.posNo = salary.posNo ?? _null;
|
||||
salaries.salaryClass = salary.salaryClass ?? _null;
|
||||
salaries.salaryRef = salary.salaryRef ?? _null;
|
||||
salaries.refCommandNo = salary.refCommandNo ?? _null;
|
||||
salaries.refCommandDate = salary.refCommandDate ?? _null;
|
||||
salaries.salaryStatus = salary.salaryStatus ?? _null;
|
||||
salaries.evaluation = evaluation;
|
||||
|
||||
await this.salaryRepository.save(salaries, { data: request });
|
||||
setLogDataDiff(request, { before, after: salaries });
|
||||
});
|
||||
|
||||
}
|
||||
//Training
|
||||
if (requestBody.trainings != null)
|
||||
requestBody.trainings.forEach(async (train) => {
|
||||
|
|
@ -871,6 +919,12 @@ export class EvaluationController {
|
|||
])
|
||||
async checkSpecGet(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
try {
|
||||
// let thaiYear: number = new Date().getFullYear() + 543;
|
||||
// let years = {
|
||||
// lastTwoYear: Extension.ToThaiNumber((thaiYear - 2).toString()),
|
||||
// lastOneYear: Extension.ToThaiNumber((thaiYear - 1).toString()),
|
||||
// currentYear: Extension.ToThaiNumber(thaiYear.toString()),
|
||||
// };
|
||||
const evaluation = await AppDataSource.getRepository(Evaluation)
|
||||
.createQueryBuilder("evaluation")
|
||||
.leftJoin("evaluation.education", "education")
|
||||
|
|
@ -932,6 +986,33 @@ export class EvaluationController {
|
|||
"salaries.refCommandNo",
|
||||
"salaries.refCommandDate",
|
||||
"salaries.salaryStatus",
|
||||
"salaries.profileId",
|
||||
"salaries.commandCode",
|
||||
"salaries.commandNo",
|
||||
"salaries.commandYear",
|
||||
"salaries.commandDateAffect",
|
||||
"salaries.commandDateSign",
|
||||
"salaries.posNoAbb",
|
||||
"salaries.positionName",
|
||||
"salaries.positionType",
|
||||
"salaries.positionLevel",
|
||||
"salaries.positionLine",
|
||||
"salaries.positionPathSide",
|
||||
"salaries.positionExecutive",
|
||||
"salaries.amountSpecial",
|
||||
"salaries.orgRoot",
|
||||
"salaries.orgChild1",
|
||||
"salaries.orgChild2",
|
||||
"salaries.orgChild3",
|
||||
"salaries.orgChild4",
|
||||
"salaries.remark",
|
||||
"salaries.commandId",
|
||||
"salaries.isGovernment",
|
||||
"salaries.positionCee",
|
||||
"salaries.commandName",
|
||||
"salaries.posNumCodeSit",
|
||||
"salaries.posNumCodeSitAbb",
|
||||
"salaries.isEntry",
|
||||
|
||||
"training.name",
|
||||
"training.topic",
|
||||
|
|
@ -952,6 +1033,7 @@ export class EvaluationController {
|
|||
"assessment.pointSumTotal",
|
||||
"assessment.pointSum",
|
||||
])
|
||||
.orderBy("salaries.commandDateAffect", "DESC")
|
||||
.getOne();
|
||||
|
||||
if (!evaluation) {
|
||||
|
|
@ -1012,6 +1094,33 @@ export class EvaluationController {
|
|||
refCommandNo: salaries.refCommandNo,
|
||||
refCommandDate: salaries.refCommandDate,
|
||||
salaryStatus: salaries.salaryStatus,
|
||||
profileId: salaries.profileId,
|
||||
commandCode: salaries.commandCode,
|
||||
commandNo: salaries.commandNo,
|
||||
commandYear: salaries.commandYear,
|
||||
commandDateAffect: salaries.commandDateAffect,
|
||||
commandDateSign: salaries.commandDateSign,
|
||||
posNoAbb: salaries.posNoAbb,
|
||||
positionName: salaries.positionName,
|
||||
positionType: salaries.positionType,
|
||||
positionLevel: salaries.positionLevel,
|
||||
positionLine: salaries.positionLine,
|
||||
positionPathSide: salaries.positionPathSide,
|
||||
positionExecutive: salaries.positionExecutive,
|
||||
amountSpecial: salaries.amountSpecial,
|
||||
orgRoot: salaries.orgRoot,
|
||||
orgChild1: salaries.orgChild1,
|
||||
orgChild2: salaries.orgChild2,
|
||||
orgChild3: salaries.orgChild3,
|
||||
orgChild4: salaries.orgChild4,
|
||||
remark: salaries.remark,
|
||||
commandId: salaries.commandId,
|
||||
isGovernment: salaries.isGovernment,
|
||||
positionCee: salaries.positionCee,
|
||||
commandName: salaries.commandName,
|
||||
posNumCodeSit: salaries.posNumCodeSit,
|
||||
posNumCodeSitAbb: salaries.posNumCodeSitAbb,
|
||||
isEntry: salaries.isEntry,
|
||||
})),
|
||||
trainings: evaluation.training.map((training) => ({
|
||||
name: training.name,
|
||||
|
|
@ -1034,6 +1143,7 @@ export class EvaluationController {
|
|||
pointSumTotal: assessment.pointSumTotal,
|
||||
pointSum: assessment.pointSum,
|
||||
})),
|
||||
// years: years
|
||||
};
|
||||
|
||||
if (!dataEvaluation) {
|
||||
|
|
@ -1210,6 +1320,33 @@ export class EvaluationController {
|
|||
"salaries.refCommandNo",
|
||||
"salaries.refCommandDate",
|
||||
"salaries.salaryStatus",
|
||||
"salaries.profileId",
|
||||
"salaries.commandCode",
|
||||
"salaries.commandNo",
|
||||
"salaries.commandYear",
|
||||
"salaries.commandDateAffect",
|
||||
"salaries.commandDateSign",
|
||||
"salaries.posNoAbb",
|
||||
"salaries.positionName",
|
||||
"salaries.positionType",
|
||||
"salaries.positionLevel",
|
||||
"salaries.positionLine",
|
||||
"salaries.positionPathSide",
|
||||
"salaries.positionExecutive",
|
||||
"salaries.amountSpecial",
|
||||
"salaries.orgRoot",
|
||||
"salaries.orgChild1",
|
||||
"salaries.orgChild2",
|
||||
"salaries.orgChild3",
|
||||
"salaries.orgChild4",
|
||||
"salaries.remark",
|
||||
"salaries.commandId",
|
||||
"salaries.isGovernment",
|
||||
"salaries.positionCee",
|
||||
"salaries.commandName",
|
||||
"salaries.posNumCodeSit",
|
||||
"salaries.posNumCodeSitAbb",
|
||||
"salaries.isEntry",
|
||||
|
||||
"training.name",
|
||||
"training.topic",
|
||||
|
|
@ -1230,6 +1367,7 @@ export class EvaluationController {
|
|||
"assessment.pointSumTotal",
|
||||
"assessment.pointSum",
|
||||
])
|
||||
.orderBy("salaries.commandDateAffect", "DESC")
|
||||
.getOne();
|
||||
|
||||
if (!evaluation) {
|
||||
|
|
@ -1290,6 +1428,33 @@ export class EvaluationController {
|
|||
refCommandNo: salaries.refCommandNo,
|
||||
refCommandDate: salaries.refCommandDate,
|
||||
salaryStatus: salaries.salaryStatus,
|
||||
profileId: salaries.profileId,
|
||||
commandCode: salaries.commandCode,
|
||||
commandNo: salaries.commandNo,
|
||||
commandYear: salaries.commandYear,
|
||||
commandDateAffect: salaries.commandDateAffect,
|
||||
commandDateSign: salaries.commandDateSign,
|
||||
posNoAbb: salaries.posNoAbb,
|
||||
positionName: salaries.positionName,
|
||||
positionType: salaries.positionType,
|
||||
positionLevel: salaries.positionLevel,
|
||||
positionLine: salaries.positionLine,
|
||||
positionPathSide: salaries.positionPathSide,
|
||||
positionExecutive: salaries.positionExecutive,
|
||||
amountSpecial: salaries.amountSpecial,
|
||||
orgRoot: salaries.orgRoot,
|
||||
orgChild1: salaries.orgChild1,
|
||||
orgChild2: salaries.orgChild2,
|
||||
orgChild3: salaries.orgChild3,
|
||||
orgChild4: salaries.orgChild4,
|
||||
remark: salaries.remark,
|
||||
commandId: salaries.commandId,
|
||||
isGovernment: salaries.isGovernment,
|
||||
positionCee: salaries.positionCee,
|
||||
commandName: salaries.commandName,
|
||||
posNumCodeSit: salaries.posNumCodeSit,
|
||||
posNumCodeSitAbb: salaries.posNumCodeSitAbb,
|
||||
isEntry: salaries.isEntry,
|
||||
})),
|
||||
trainings: evaluation.training.map((training) => ({
|
||||
name: training.name,
|
||||
|
|
@ -2376,6 +2541,7 @@ export class EvaluationController {
|
|||
"commanderAbovePosition",
|
||||
],
|
||||
});
|
||||
|
||||
if (!evaluation) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ export class ReoportController {
|
|||
"certificate.issueDate",
|
||||
"certificate.expireDate",
|
||||
|
||||
|
||||
"salaries.date",
|
||||
"salaries.amount",
|
||||
"salaries.positionSalaryAmount",
|
||||
|
|
@ -218,6 +219,33 @@ export class ReoportController {
|
|||
"salaries.refCommandNo",
|
||||
"salaries.refCommandDate",
|
||||
"salaries.salaryStatus",
|
||||
"salaries.profileId",
|
||||
"salaries.commandCode",
|
||||
"salaries.commandNo",
|
||||
"salaries.commandYear",
|
||||
"salaries.commandDateAffect",
|
||||
"salaries.commandDateSign",
|
||||
"salaries.posNoAbb",
|
||||
"salaries.positionName",
|
||||
"salaries.positionType",
|
||||
"salaries.positionLevel",
|
||||
"salaries.positionLine",
|
||||
"salaries.positionPathSide",
|
||||
"salaries.positionExecutive",
|
||||
"salaries.amountSpecial",
|
||||
"salaries.orgRoot",
|
||||
"salaries.orgChild1",
|
||||
"salaries.orgChild2",
|
||||
"salaries.orgChild3",
|
||||
"salaries.orgChild4",
|
||||
"salaries.remark",
|
||||
"salaries.commandId",
|
||||
"salaries.isGovernment",
|
||||
"salaries.positionCee",
|
||||
"salaries.commandName",
|
||||
"salaries.posNumCodeSit",
|
||||
"salaries.posNumCodeSitAbb",
|
||||
"salaries.isEntry",
|
||||
|
||||
"training.name",
|
||||
"training.topic",
|
||||
|
|
@ -238,6 +266,7 @@ export class ReoportController {
|
|||
"assessment.pointSumTotal",
|
||||
"assessment.pointSum",
|
||||
])
|
||||
.orderBy("salaries.commandDateAffect", "DESC")
|
||||
.getOne();
|
||||
|
||||
if (!evaluation) {
|
||||
|
|
@ -290,6 +319,8 @@ export class ReoportController {
|
|||
lastOneYear: Extension.ToThaiNumber((thaiYear - 1).toString()),
|
||||
currentYear: Extension.ToThaiNumber(thaiYear.toString()),
|
||||
};
|
||||
let _orgNoNewLine = (org ? org : "-").replace(/\n/g, " ");
|
||||
let typeTh = evaluation.type == "EXPERT" ? "ชำนาญการ" : evaluation.type == "EXPERTISE" ? "เชียวชาญ" : evaluation.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ":"";
|
||||
const dataEvaluation = {
|
||||
isEducationalQft: evaluation.isEducationalQft,
|
||||
isGovermantServiceHtr: evaluation.isGovermantServiceHtr,
|
||||
|
|
@ -299,15 +330,18 @@ export class ReoportController {
|
|||
isHaveProLicense: evaluation.isHaveProLicense,
|
||||
isHaveMinPeriodOrHoldPos: evaluation.isHaveMinPeriodOrHoldPos,
|
||||
type: evaluation.type,
|
||||
typeTh: typeTh,
|
||||
prefix: evaluation.prefix,
|
||||
fullName: evaluation.fullName ? `${evaluation.fullName}` : "-",
|
||||
position: evaluation.position ? evaluation.position : "-",
|
||||
posNo: evaluation.posNo ? Extension.ToThaiNumber(evaluation.posNo) : "-",
|
||||
fullName: evaluation.fullName ? `${evaluation.fullName}` : "",
|
||||
position: evaluation.position ? evaluation.position : "",
|
||||
posNo: evaluation.posNo ? Extension.ToThaiNumber(evaluation.posNo) : "",
|
||||
posNoWithSym: evaluation.posNo ? `(${Extension.ToThaiNumber(evaluation.posNo)})` : "",
|
||||
oc: evaluation.oc ? evaluation.oc : "-",
|
||||
org: org ? org : "-", //สังกัด
|
||||
orgNoNewLine: _orgNoNewLine ? _orgNoNewLine : "-", //สังกัดแบบไม่เว้นวรรค
|
||||
root: root ? root : "-", //หน่วยงาน
|
||||
salary: evaluation.salary ? Extension.ToThaiNumber(evaluation.salary) : "-",
|
||||
positionLevel: evaluation.positionLevel ? evaluation.positionLevel : "-",
|
||||
positionLevel: evaluation.positionLevel ? evaluation.positionLevel : "",
|
||||
birthDate:
|
||||
evaluation.birthDate != null && evaluation.birthDate != ""
|
||||
? Extension.ToThaiNumber(
|
||||
|
|
@ -340,13 +374,13 @@ export class ReoportController {
|
|||
startDate: education.startDate,
|
||||
endDate: education.endDate,
|
||||
finishDate: education.finishDate
|
||||
? Extension.ToThaiNumber(
|
||||
? `(${Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate(education.finishDate).toString(),
|
||||
)
|
||||
: "-",
|
||||
)})`
|
||||
: "",
|
||||
isEducation: education.isEducation,
|
||||
degree: education.degree ? Extension.ToThaiNumber(education.degree) : "-",
|
||||
field: education.field ? Extension.ToThaiNumber(education.field) : "-",
|
||||
field: education.field ? `(${Extension.ToThaiNumber(education.field)})` : "",
|
||||
fundName: education.fundName,
|
||||
gpa: education.gpa,
|
||||
country: education.country,
|
||||
|
|
@ -389,13 +423,13 @@ export class ReoportController {
|
|||
salaries:
|
||||
evaluation.salaries.length > 0
|
||||
? evaluation.salaries.map((salaries) => ({
|
||||
date: salaries.date
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(salaries.date))
|
||||
date: salaries.commandDateAffect
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(salaries.commandDateAffect))
|
||||
: "-",
|
||||
amount: salaries.amount
|
||||
? Extension.ToThaiNumber(salaries.amount.toLocaleString())
|
||||
: "-",
|
||||
position: salaries.position ? Extension.ToThaiNumber(salaries.position) : "-",
|
||||
position: salaries.positionName ? Extension.ToThaiNumber(salaries.positionName) : "-",
|
||||
positionSalaryAmount: salaries.positionSalaryAmount,
|
||||
mouthSalaryAmount: salaries.mouthSalaryAmount,
|
||||
posNo: salaries.posNo,
|
||||
|
|
@ -404,6 +438,11 @@ export class ReoportController {
|
|||
refCommandNo: salaries.refCommandNo,
|
||||
refCommandDate: salaries.refCommandDate,
|
||||
salaryStatus: salaries.salaryStatus,
|
||||
org: (salaries.orgChild4 ? salaries.orgChild4 + "\n" : "") +
|
||||
(salaries.orgChild3 ? salaries.orgChild3 + "\n" : "") +
|
||||
(salaries.orgChild2 ? salaries.orgChild2 + "\n" : "") +
|
||||
(salaries.orgChild1 ? salaries.orgChild1 + "\n" : "") +
|
||||
(salaries.orgRoot ? salaries.orgRoot : ""),
|
||||
}))
|
||||
: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
|
||||
import { Entity, Column, OneToMany, ManyToMany, JoinTable, Double } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { EvaluationLogs } from "./EvaluationLogs";
|
||||
import { Education } from "./Education";
|
||||
|
|
@ -416,41 +416,37 @@ export class CreateCertificate {
|
|||
}
|
||||
|
||||
export class CreateSalary {
|
||||
@Column()
|
||||
step?: string | null;
|
||||
|
||||
@Column()
|
||||
date?: Date | null;
|
||||
|
||||
@Column()
|
||||
amount?: number | null;
|
||||
|
||||
@Column()
|
||||
positionSalaryAmount?: number | null;
|
||||
|
||||
@Column()
|
||||
mouthSalaryAmount?: number | null;
|
||||
|
||||
@Column()
|
||||
position?: string | null;
|
||||
|
||||
@Column()
|
||||
profileId?: string | null;
|
||||
commandCode?: string | null;
|
||||
commandNo?: string | null;
|
||||
commandYear?: number | null;
|
||||
commandDateAffect?: Date | null;
|
||||
commandDateSign?: Date | null;
|
||||
posNoAbb?: string | null;
|
||||
posNo?: string | null;
|
||||
|
||||
@Column()
|
||||
salaryClass?: string | null;
|
||||
|
||||
@Column()
|
||||
salaryRef?: string | null;
|
||||
|
||||
@Column()
|
||||
refCommandNo?: string | null;
|
||||
|
||||
@Column()
|
||||
refCommandDate?: Date | null;
|
||||
|
||||
@Column()
|
||||
salaryStatus?: string | null;
|
||||
positionName?: string | null;
|
||||
positionType?: string | null;
|
||||
positionLevel?: string | null;
|
||||
positionLine?: string | null;
|
||||
positionPathSide?: string | null;
|
||||
positionExecutive?: string | null;
|
||||
amount?: Double | null;
|
||||
amountSpecial?: Double | null;
|
||||
positionSalaryAmount?: Double | null;
|
||||
mouthSalaryAmount?: Double | null;
|
||||
orgRoot?: string | null;
|
||||
orgChild1?: string | null;
|
||||
orgChild2?: string | null;
|
||||
orgChild3?: string | null;
|
||||
orgChild4?: string | null;
|
||||
remark?: string | null;
|
||||
commandId?: string | null;
|
||||
isGovernment?: boolean | null;
|
||||
positionCee?: string | null;
|
||||
commandName?: string | null;
|
||||
posNumCodeSit?: string | null;
|
||||
posNumCodeSitAbb?: string | null;
|
||||
isEntry?: boolean | null;
|
||||
}
|
||||
export class CreateTraining {
|
||||
@Column()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne } from "typeorm";
|
||||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, Double } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Evaluation } from "./Evaluation";
|
||||
|
||||
|
|
@ -44,9 +44,242 @@ export class Salary extends EntityBase {
|
|||
@Column({ nullable: true, comment: "ประเภทตำแหน่งกรณีพิเศษ" })
|
||||
salaryStatus: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
type: "uuid",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เรียงลำดับใหมาตามการนำเข้า",
|
||||
default: null,
|
||||
})
|
||||
order: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เลขที่คำสั่ง",
|
||||
default: null,
|
||||
})
|
||||
commandNo: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ปีที่ออกคำสั่ง",
|
||||
default: null,
|
||||
})
|
||||
commandYear: number;
|
||||
|
||||
@Column({
|
||||
comment: "คำสั่งวันที่",
|
||||
type: "datetime",
|
||||
nullable: true,
|
||||
})
|
||||
commandDateSign: Date;
|
||||
|
||||
@Column({
|
||||
comment: "คำสั่งมีผลวันที่",
|
||||
type: "datetime",
|
||||
nullable: true,
|
||||
})
|
||||
commandDateAffect: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "รหัสประเภทของคำสั่ง",
|
||||
default: null,
|
||||
})
|
||||
commandCode: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อประเภทคำสั่ง",
|
||||
default: null,
|
||||
})
|
||||
commandName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "ตัวย่อเลขที่ตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
posNoAbb: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ประเภทตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionType: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ระดับตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionLevel: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับของเก่าที่ยังไม่เทียบเท่าแบบแท่ง",
|
||||
default: null,
|
||||
})
|
||||
positionCee: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "root name",
|
||||
default: null,
|
||||
})
|
||||
orgRoot: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "child1 name",
|
||||
default: null,
|
||||
})
|
||||
orgChild1: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "child2 name",
|
||||
default: null,
|
||||
})
|
||||
orgChild2: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "child3 name",
|
||||
default: null,
|
||||
})
|
||||
orgChild3: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "child4 name",
|
||||
default: null,
|
||||
})
|
||||
orgChild4: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่งทางการบริหาร",
|
||||
default: null,
|
||||
})
|
||||
positionExecutive: string;
|
||||
|
||||
@Column({
|
||||
comment: "เงินพิเศษ",
|
||||
default: 0,
|
||||
nullable: true,
|
||||
type: "double",
|
||||
})
|
||||
amountSpecial: Double;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "text",
|
||||
comment: "หมายเหตุ",
|
||||
default: null,
|
||||
})
|
||||
remark: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "refId",
|
||||
default: null,
|
||||
})
|
||||
refId: string;
|
||||
|
||||
@Column({
|
||||
comment: "วันที่",
|
||||
type: "datetime",
|
||||
nullable: true,
|
||||
})
|
||||
dateGovernment: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เข้ารับราชการ",
|
||||
default: null,
|
||||
})
|
||||
isGovernment: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
comment: "ข้อมูลจาก Entry",
|
||||
default: null,
|
||||
})
|
||||
isEntry: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ด้านของตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
positionPathSide: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "ตำแหน่งในสายงาน",
|
||||
default: null,
|
||||
})
|
||||
positionLine: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง command",
|
||||
default: null,
|
||||
})
|
||||
commandId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "หน่วยงานที่ออกคำสั่ง",
|
||||
default: null,
|
||||
})
|
||||
posNumCodeSit: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 255,
|
||||
comment: "หน่วยงานที่ออกคำสั่ง(ตัวย่อ)",
|
||||
default: null,
|
||||
})
|
||||
posNumCodeSitAbb: string;
|
||||
|
||||
@ManyToOne(() => Evaluation, (Evaluation) => Evaluation.salaries)
|
||||
@JoinColumn({ name: "evaluationId" })
|
||||
evaluation: Evaluation;
|
||||
}
|
||||
|
||||
|
||||
export type UpdateSalary = Partial<Salary>;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,20 @@ export type LogSequence = {
|
|||
};
|
||||
|
||||
export function setLogDataDiff(req: RequestWithUser, data: DataDiff) {
|
||||
req.app.locals.logData.dataDiff = {
|
||||
before: JSON.stringify(data.before),
|
||||
after: JSON.stringify(data.after),
|
||||
};
|
||||
// Check if data.before and data.after are valid objects
|
||||
if (
|
||||
data.before &&
|
||||
typeof data.before === "object" &&
|
||||
data.after &&
|
||||
typeof data.after === "object"
|
||||
) {
|
||||
req.app.locals.logData.dataDiff = {
|
||||
before: JSON.stringify(data.before),
|
||||
after: JSON.stringify(data.after),
|
||||
};
|
||||
} else {
|
||||
console.error("Invalid data provided: both before and after must be valid objects.");
|
||||
}
|
||||
}
|
||||
|
||||
export function addLogSequence(req: RequestWithUser, data: LogSequence) {
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableEvaAddRoot1730874813739 implements MigrationInterface {
|
||||
name = 'UpdateTableEvaAddRoot1730874813739'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`rootId\` varchar(255) NULL COMMENT 'root'`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`child1Id\` varchar(255) NULL COMMENT 'child1'`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`child2Id\` varchar(255) NULL COMMENT 'child2'`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`child3Id\` varchar(255) NULL COMMENT 'child3'`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`child4Id\` varchar(255) NULL COMMENT 'child4'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`child4Id\``);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`child3Id\``);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`child2Id\``);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`child1Id\``);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`rootId\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class Update12202024me1734665465868 implements MigrationInterface {
|
||||
name = 'Update12202024me1734665465868'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`evaluationResult\` varchar(255) NULL COMMENT 'ผลการประเมิน' DEFAULT 'PENDING'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`evaluationResult\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateEvaAddRoot1736140332359 implements MigrationInterface {
|
||||
name = 'UpdateEvaAddRoot1736140332359'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`root\` varchar(255) NULL COMMENT 'สำนักงานที่สังกัด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`orgRootId\` varchar(255) NULL COMMENT 'ไอดีสำนักงานที่สังกัด'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`orgRootId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`root\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateSalaryAddProfilesalaeyAll1744102850613 implements MigrationInterface {
|
||||
name = 'UpdateSalaryAddProfilesalaeyAll1744102850613'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`order\` int NULL COMMENT 'เรียงลำดับใหมาตามการนำเข้า'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandYear\` int NULL COMMENT 'ปีที่ออกคำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandDateSign\` datetime NULL COMMENT 'คำสั่งวันที่'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandDateAffect\` datetime NULL COMMENT 'คำสั่งมีผลวันที่'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandCode\` varchar(255) NULL COMMENT 'รหัสประเภทของคำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandName\` varchar(255) NULL COMMENT 'ชื่อประเภทคำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`posNoAbb\` varchar(40) NULL COMMENT 'ตัวย่อเลขที่ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionName\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionType\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionLevel\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionCee\` varchar(255) NULL COMMENT 'ระดับของเก่าที่ยังไม่เทียบเท่าแบบแท่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`orgRoot\` varchar(255) NULL COMMENT 'root name'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`orgChild1\` varchar(255) NULL COMMENT 'child1 name'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`orgChild2\` varchar(255) NULL COMMENT 'child2 name'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`orgChild3\` varchar(255) NULL COMMENT 'child3 name'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`orgChild4\` varchar(255) NULL COMMENT 'child4 name'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionExecutive\` varchar(255) NULL COMMENT 'ตำแหน่งทางการบริหาร'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`remark\` text NULL COMMENT 'หมายเหตุ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`refId\` varchar(255) NULL COMMENT 'refId'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`dateGovernment\` datetime NULL COMMENT 'วันที่'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`isGovernment\` tinyint NULL COMMENT 'เข้ารับราชการ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`isEntry\` tinyint NOT NULL COMMENT 'ข้อมูลจาก Entry'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionPathSide\` varchar(255) NULL COMMENT 'ด้านของตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`positionLine\` varchar(255) NULL COMMENT 'ตำแหน่งในสายงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`commandId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง command'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`posNumCodeSit\` varchar(255) NULL COMMENT 'หน่วยงานที่ออกคำสั่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` ADD \`posNumCodeSitAbb\` varchar(255) NULL COMMENT 'หน่วยงานที่ออกคำสั่ง(ตัวย่อ)'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`posNumCodeSitAbb\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`posNumCodeSit\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionLine\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionPathSide\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`isEntry\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`isGovernment\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`dateGovernment\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`refId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`remark\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`amountSpecial\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionExecutive\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`orgChild4\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`orgChild3\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`orgChild2\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`orgChild1\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`orgRoot\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionCee\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionLevel\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionType\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`positionName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`posNoAbb\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandCode\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandDateAffect\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandDateSign\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandYear\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`commandNo\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`order\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`profileEmployeeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salary\` DROP COLUMN \`profileId\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -167,6 +167,37 @@ export async function updateFile(path: string[], file: string, metadata: FilePro
|
|||
return Boolean(res);
|
||||
}
|
||||
|
||||
export async function updateFile2(
|
||||
path: string[],
|
||||
file: string,
|
||||
metadata: FileProps,
|
||||
destPath?: string[],
|
||||
destFile?: string,
|
||||
) {
|
||||
const res = await fetch(`${STORAGE_URL}/storage/file`, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
Authorization: `Bearer ${await getToken()}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
from: { path, file },
|
||||
to: destPath && destFile ? { path: destPath, file: destFile } : undefined,
|
||||
...metadata,
|
||||
upload: false,
|
||||
}),
|
||||
}).catch((e) => console.error(e));
|
||||
|
||||
if (!res || !res.ok) {
|
||||
if (res && res.status === HttpStatus.NOT_FOUND) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบไฟล์ในระบบ");
|
||||
}
|
||||
return Boolean(console.error(res ? await res.json() : res));
|
||||
}
|
||||
|
||||
return Boolean(res);
|
||||
}
|
||||
|
||||
export async function deleteFolder(path: string[], name: string) {
|
||||
const res = await fetch(`${STORAGE_URL}/storage/folder`, {
|
||||
method: "DELETE",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue