เลื่อนเงินเดือนลูกจ้าง

This commit is contained in:
Kittapath 2024-03-21 22:59:53 +07:00
parent d3dd7012a1
commit 9449a1f989
7 changed files with 448 additions and 441 deletions

View file

@ -56,12 +56,12 @@ export class SalaryRankEmployeeController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผังเงินเดือนนี้");
}
const checkStep = await this.salaryRankEmployeeRepository.find({
where: {
where: {
step: requestBody.step,
salaryEmployeeId: requestBody.salaryEmployeeId
}
salaryEmployeeId: requestBody.salaryEmployeeId,
},
});
if(checkStep.length > 0){
if (checkStep.length > 0) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถเพิ่มได้ เนื่องจากลำดับขั้นนี้ซ้ำ");
}
const salaryRankEmployee = Object.assign(new SalaryRankEmployee(), requestBody);
@ -96,13 +96,13 @@ export class SalaryRankEmployeeController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับผังเงินเดือนนี้");
}
const checkStep = await this.salaryRankEmployeeRepository.find({
where: {
where: {
id: Not(id),
step: requestBody.step,
salaryEmployeeId: salaryRankEmployee.salaryEmployeeId
}
salaryEmployeeId: salaryRankEmployee.salaryEmployeeId,
},
});
if(checkStep.length > 0){
if (checkStep.length > 0) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถแก้ไขได้ เนื่องจากลำดับขั้นนี้ซ้ำ");
}
salaryRankEmployee.lastUpdateUserId = request.user.sub;
@ -147,15 +147,17 @@ export class SalaryRankEmployeeController extends Controller {
if (keyword != undefined && keyword !== "") {
whereClause = {
where: [
{ salaryEmployeeId: id, },
{ step: Like(`%${keyword}%`) },
{ salaryMonth: Like(`%${keyword}%`) },
{ salaryMonth: Like(`%${keyword}%`) },
{ salaryDay: Like(`%${keyword}%`) },
],
};
}
const [salaryRankEmployee, total] = await this.salaryRankEmployeeRepository.findAndCount({
...whereClause,
where: {
salaryEmployeeId: id,
},
select: ["id", "step", "salaryMonth", "salaryDay"],
order: {
step: "ASC",