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

This commit is contained in:
Kittapath 2024-03-13 09:30:04 +07:00
parent 0cf3d3dc85
commit 87f29e22e9
7 changed files with 699 additions and 61 deletions

View file

@ -19,7 +19,6 @@ import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { CreateSalaryRank, SalaryRanks, UpdateSalaryRank } from "../entities/SalaryRanks";
import { Not } from "typeorm";
import { Salarys } from "../entities/Salarys";
@Route("api/v1/salary/rate")
@Tags("SalaryRank")
@ -50,10 +49,7 @@ export class SalaryRanksController extends Controller {
where: { id: requestBody.salaryId },
});
if (!checkSalary) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลผังเงินเดือนนี้"
);
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผังเงินเดือนนี้");
}
const salaryRank = Object.assign(new SalaryRanks(), requestBody);
salaryRank.createdUserId = request.user.sub;
@ -81,7 +77,6 @@ export class SalaryRanksController extends Controller {
requestBody: UpdateSalaryRank,
@Request() request: { user: Record<string, any> },
) {
// try {
const salaryRank = await this.salaryRankRepository.findOne({ where: { id: id } });
if (!salaryRank) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับผังเงินเดือนนี้");
@ -91,9 +86,6 @@ export class SalaryRanksController extends Controller {
this.salaryRankRepository.merge(salaryRank, requestBody);
await this.salaryRankRepository.save(salaryRank);
return new HttpSuccess();
// } catch (error: any) {
// throw new Error(error);
// }
}
/**
@ -105,7 +97,6 @@ export class SalaryRanksController extends Controller {
*/
@Delete("{id}")
async deleteSalaryRanks(@Path() id: string) {
// try {
const delSalaryRanks = await this.salaryRankRepository.findOne({
where: { id },
});
@ -114,34 +105,8 @@ export class SalaryRanksController extends Controller {
}
await this.salaryRankRepository.delete({ id: id });
return new HttpSuccess();
// } catch (error: any) {
// throw new Error(error);
// }
}
// /**
// * API รายละเอียดรายการอัตราเงินเดือน
// *
// * @summary ORG_059 - รายละเอียดรายการอัตราเงินเดือน (ADMIN) #65
// *
// * @param {string} id Id อัตราเงินเดือน
// */
// @Get("{id}")
// async detailSalaryRanks(@Path() id: string) {
// const salaryRank = await this.salaryRankRepository.findOne({
// where: { id },
// select: ["id"],
// });
// if (!salaryRank) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
// }
// try {
// return new HttpSuccess(salaryRank);
// } catch (error) {
// return error;
// }
// }
/**
* API
*
@ -156,7 +121,6 @@ export class SalaryRanksController extends Controller {
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
const [salaryRank, total] = await this.salaryRankRepository.findAndCount({
where: {
salaryId: id,