2024-04-22 13:23:31 +07:00
|
|
|
import {
|
|
|
|
|
Controller,
|
|
|
|
|
Get,
|
|
|
|
|
Post,
|
|
|
|
|
Put,
|
|
|
|
|
Delete,
|
|
|
|
|
Route,
|
|
|
|
|
Security,
|
|
|
|
|
Tags,
|
|
|
|
|
Body,
|
|
|
|
|
Path,
|
|
|
|
|
Request,
|
|
|
|
|
Example,
|
|
|
|
|
SuccessResponse,
|
|
|
|
|
Response,
|
|
|
|
|
Query,
|
2024-04-26 10:18:00 +07:00
|
|
|
ArrayValidator,
|
2024-04-22 13:23:31 +07:00
|
|
|
} from "tsoa";
|
|
|
|
|
import { AppDataSource } from "../database/data-source";
|
|
|
|
|
import HttpSuccess from "../interfaces/http-success";
|
|
|
|
|
import HttpError from "../interfaces/http-error";
|
|
|
|
|
import HttpStatusCode from "../interfaces/http-status";
|
|
|
|
|
import { KpiPeriod } from "../entities/kpiPeriod";
|
2024-04-26 10:18:00 +07:00
|
|
|
import {
|
|
|
|
|
KpiUserEvaluation,
|
|
|
|
|
createKpiUserEvaluation,
|
2024-04-26 13:08:23 +07:00
|
|
|
updateKpiUserCheckEvaluation,
|
2024-04-26 10:18:00 +07:00
|
|
|
updateKpiUserEvaluation,
|
2024-04-26 17:39:24 +07:00
|
|
|
updateKpiUserPointEvaluation,
|
2024-04-26 10:18:00 +07:00
|
|
|
} from "../entities/kpiUserEvaluation";
|
2024-04-26 17:39:24 +07:00
|
|
|
import { Like, In, Brackets } from "typeorm";
|
2024-04-22 13:23:31 +07:00
|
|
|
import CallAPI from "../interfaces/call-api";
|
2024-04-26 17:39:24 +07:00
|
|
|
import {
|
|
|
|
|
KpiUserEvaluationReason,
|
|
|
|
|
updateKpiUserReasonEvaluation,
|
|
|
|
|
} from "../entities/kpiUserEvaluationReason";
|
2024-04-22 13:23:31 +07:00
|
|
|
|
|
|
|
|
@Route("api/v1/kpi/user/evaluation")
|
|
|
|
|
@Tags("kpiUserEvaluation")
|
|
|
|
|
@Security("bearerAuth")
|
|
|
|
|
@Response(
|
|
|
|
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
|
|
|
|
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
|
|
|
|
)
|
|
|
|
|
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
|
|
|
|
export class KpiUserEvaluationController extends Controller {
|
|
|
|
|
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
|
|
|
|
private kpiUserEvalutionRepository = AppDataSource.getRepository(KpiUserEvaluation);
|
2024-04-26 17:39:24 +07:00
|
|
|
private kpiUserEvaluationReasonRepository = AppDataSource.getRepository(KpiUserEvaluationReason);
|
2024-04-22 13:23:31 +07:00
|
|
|
|
2024-04-26 10:18:00 +07:00
|
|
|
/**
|
|
|
|
|
* API
|
|
|
|
|
*
|
|
|
|
|
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคลทั้งหมด
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Get("admin")
|
|
|
|
|
async listKpiAdminEvaluation(
|
|
|
|
|
@Query("page") page: number = 1,
|
|
|
|
|
@Query("pageSize") pageSize: number = 10,
|
|
|
|
|
@Query("kpiPeriodId") kpiPeriodId?: string,
|
2024-04-26 17:39:24 +07:00
|
|
|
@Query("keyword") keyword?: string,
|
2024-04-26 10:18:00 +07:00
|
|
|
) {
|
|
|
|
|
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
|
|
|
|
.createQueryBuilder("kpiUserEvaluation")
|
|
|
|
|
.andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
2024-04-26 12:40:43 +07:00
|
|
|
kpiPeriodId: kpiPeriodId,
|
2024-04-26 10:18:00 +07:00
|
|
|
})
|
2024-04-26 17:39:24 +07:00
|
|
|
.andWhere(
|
|
|
|
|
new Brackets((qb) => {
|
|
|
|
|
qb.orWhere("kpiUserEvaluation.prefix LIKE :keyword", { keyword: `%${keyword}%` })
|
|
|
|
|
.orWhere("kpiUserEvaluation.firstName LIKE :keyword", { keyword: `%${keyword}%` })
|
|
|
|
|
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", { keyword: `%${keyword}%` });
|
|
|
|
|
}),
|
|
|
|
|
)
|
2024-04-26 10:18:00 +07:00
|
|
|
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
|
|
|
|
.skip((page - 1) * pageSize)
|
|
|
|
|
.take(pageSize)
|
|
|
|
|
.getManyAndCount();
|
|
|
|
|
|
|
|
|
|
const mapData = kpiUserEvaluation.map((item) => ({
|
|
|
|
|
id: item.id,
|
|
|
|
|
profileId: item.profileId,
|
|
|
|
|
prefix: item.prefix,
|
|
|
|
|
firstname: item.firstName,
|
|
|
|
|
lastname: item.lastName,
|
|
|
|
|
kpiPeriodId: item.kpiPeriodId,
|
|
|
|
|
evaluationStatus: item.evaluationStatus,
|
|
|
|
|
evaluationResults: item.evaluationResults,
|
|
|
|
|
createdAt: item.createdAt,
|
2024-04-26 13:17:25 +07:00
|
|
|
evaluatorId: item.evaluatorId,
|
|
|
|
|
commanderId: item.commanderId,
|
|
|
|
|
commanderHighId: item.commanderHighId,
|
2024-04-26 10:18:00 +07:00
|
|
|
}));
|
|
|
|
|
return new HttpSuccess({ data: mapData, total });
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 13:23:31 +07:00
|
|
|
/**
|
|
|
|
|
* API สร้างรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
2024-04-26 10:18:00 +07:00
|
|
|
*
|
2024-04-22 13:23:31 +07:00
|
|
|
* @summary สร้างรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
2024-04-26 10:18:00 +07:00
|
|
|
*
|
|
|
|
|
*
|
2024-04-22 13:23:31 +07:00
|
|
|
*/
|
|
|
|
|
@Post()
|
|
|
|
|
async CreateKpiUserEvaluation(
|
|
|
|
|
@Body() requestBody: createKpiUserEvaluation,
|
|
|
|
|
@Request() request: { user: Record<string, any> },
|
2024-04-26 10:18:00 +07:00
|
|
|
) {
|
2024-04-22 13:23:31 +07:00
|
|
|
const kpiPeriod = await this.kpiPeriodRepository.findOne({
|
|
|
|
|
where: { id: requestBody.kpiPeriodId },
|
|
|
|
|
});
|
|
|
|
|
if (!kpiPeriod) {
|
|
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรอบการประเมินผลการปฏิบัติหน้าที่ราชการนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-04-26 10:18:00 +07:00
|
|
|
|
2024-04-22 13:23:31 +07:00
|
|
|
const kpiUserEvaluation = Object.assign(new KpiUserEvaluation(), requestBody);
|
|
|
|
|
await new CallAPI()
|
|
|
|
|
.GetData(request, "org/profile/keycloak/position")
|
|
|
|
|
.then((x) => {
|
2024-04-26 10:18:00 +07:00
|
|
|
kpiUserEvaluation.profileId = x.profileId;
|
|
|
|
|
kpiUserEvaluation.prefix = x.prefix;
|
|
|
|
|
kpiUserEvaluation.firstName = x.firstName;
|
|
|
|
|
kpiUserEvaluation.lastName = x.lastName;
|
2024-04-22 13:23:31 +07:00
|
|
|
})
|
|
|
|
|
.catch((x) => {});
|
2024-05-08 14:03:13 +07:00
|
|
|
kpiUserEvaluation.evaluationStatus = "NEW";
|
2024-04-26 10:18:00 +07:00
|
|
|
kpiUserEvaluation.evaluationResults = "PENDING";
|
|
|
|
|
kpiUserEvaluation.createdUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluation.createdFullName = request.user.name;
|
|
|
|
|
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
|
|
|
|
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
|
|
|
|
return new HttpSuccess(kpiUserEvaluation.id);
|
2024-04-22 13:23:31 +07:00
|
|
|
}
|
|
|
|
|
|
2024-04-26 13:08:23 +07:00
|
|
|
/**
|
|
|
|
|
* API แก้ไขคนประเมิน (USER)
|
|
|
|
|
*
|
|
|
|
|
* @summary แก้ไขคนประเมิน (USER)
|
|
|
|
|
*
|
|
|
|
|
* @param {string} id Guid, *Id คนประเมิน (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Put("check/{id}")
|
|
|
|
|
async updateKpiUserCheckEvaluation(
|
|
|
|
|
@Path() id: string,
|
|
|
|
|
@Body() requestBody: updateKpiUserCheckEvaluation,
|
|
|
|
|
@Request() request: { user: Record<string, any> },
|
|
|
|
|
) {
|
|
|
|
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
|
|
|
|
where: { id: id },
|
|
|
|
|
});
|
|
|
|
|
if (!kpiUserEvaluation) {
|
|
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
|
|
|
|
Object.assign(kpiUserEvaluation, requestBody);
|
|
|
|
|
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
|
|
|
|
return new HttpSuccess(kpiUserEvaluation.id);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-26 17:39:24 +07:00
|
|
|
/**
|
|
|
|
|
* API แก้ไขคนประเมิน (USER)
|
|
|
|
|
*
|
|
|
|
|
* @summary แก้ไขคนประเมิน (USER)
|
|
|
|
|
*
|
|
|
|
|
* @param {string} id Guid, *Id คนประเมิน (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Put("point/{id}")
|
|
|
|
|
async updateKpiUserPointEvaluation(
|
|
|
|
|
@Path() id: string,
|
|
|
|
|
@Body() requestBody: updateKpiUserPointEvaluation,
|
|
|
|
|
@Request() request: { user: Record<string, any> },
|
|
|
|
|
) {
|
|
|
|
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
|
|
|
|
where: { id: id },
|
|
|
|
|
});
|
|
|
|
|
if (!kpiUserEvaluation) {
|
|
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
|
|
|
|
Object.assign(kpiUserEvaluation, requestBody);
|
|
|
|
|
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
|
|
|
|
return new HttpSuccess(kpiUserEvaluation.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API แก้ไขหมายเหตุ (USER)
|
|
|
|
|
*
|
|
|
|
|
* @summary แก้ไขหมายเหตุ (USER)
|
|
|
|
|
*
|
|
|
|
|
* @param {string} id Guid, *Id คนประเมิน (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Put("{type}/{id}")
|
|
|
|
|
async updateKpiUserEvaluatorEvaluation(
|
|
|
|
|
@Path() id: string,
|
|
|
|
|
@Path() type: string,
|
|
|
|
|
@Body() requestBody: updateKpiUserReasonEvaluation,
|
|
|
|
|
@Request() request: { user: Record<string, any> },
|
|
|
|
|
) {
|
|
|
|
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
|
|
|
|
where: { id: id },
|
|
|
|
|
});
|
|
|
|
|
if (!kpiUserEvaluation) {
|
|
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReason(), requestBody);
|
|
|
|
|
kpiUserEvaluationReason.type = type.trim().toUpperCase();
|
|
|
|
|
kpiUserEvaluationReason.kpiUserEvaluationId = id;
|
|
|
|
|
kpiUserEvaluationReason.createdUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluationReason.createdFullName = request.user.name;
|
|
|
|
|
kpiUserEvaluationReason.lastUpdateUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluationReason.lastUpdateFullName = request.user.name;
|
|
|
|
|
await this.kpiUserEvaluationReasonRepository.save(kpiUserEvaluationReason);
|
|
|
|
|
return new HttpSuccess(kpiUserEvaluation.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API list หมายเหตุ (USER)
|
|
|
|
|
*
|
|
|
|
|
* @summary list หมายเหตุ (USER)
|
|
|
|
|
*
|
|
|
|
|
* @param {string} id Guid, *Id คนประเมิน (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Get("{type}/{id}")
|
|
|
|
|
async listKpiUserCommanderEvaluation(@Path() id: string, @Path() type: string) {
|
|
|
|
|
const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRepository.find({
|
|
|
|
|
where: { kpiUserEvaluationId: id, type: type.trim().toUpperCase() },
|
2024-04-29 13:14:40 +07:00
|
|
|
order: { createdAt: "ASC" }
|
2024-04-26 17:39:24 +07:00
|
|
|
});
|
|
|
|
|
return new HttpSuccess(kpiUserEvaluationReason);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 13:23:31 +07:00
|
|
|
/**
|
|
|
|
|
* API แก้ไขรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
2024-04-26 10:18:00 +07:00
|
|
|
*
|
2024-04-22 13:23:31 +07:00
|
|
|
* @summary แก้ไขรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
2024-04-26 10:18:00 +07:00
|
|
|
*
|
2024-04-22 13:23:31 +07:00
|
|
|
* @param {string} id Guid, *Id รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Put("{id}")
|
|
|
|
|
async updateKpiUserEvaluation(
|
|
|
|
|
@Path() id: string,
|
|
|
|
|
@Body() requestBody: updateKpiUserEvaluation,
|
|
|
|
|
@Request() request: { user: Record<string, any> },
|
|
|
|
|
) {
|
|
|
|
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
|
|
|
|
where: { id: id },
|
|
|
|
|
});
|
2024-04-26 13:08:23 +07:00
|
|
|
if (!kpiUserEvaluation) {
|
2024-04-22 13:23:31 +07:00
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const kpiPeriod = await this.kpiPeriodRepository.findOne({
|
|
|
|
|
where: { id: requestBody.kpiPeriodId },
|
|
|
|
|
});
|
|
|
|
|
if (!kpiPeriod) {
|
|
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรอบการประเมินผลการปฏิบัติหน้าที่ราชการนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-26 13:08:23 +07:00
|
|
|
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
|
|
|
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
|
|
|
|
this.kpiUserEvalutionRepository.merge(kpiUserEvaluation, requestBody);
|
|
|
|
|
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
|
|
|
|
return new HttpSuccess(kpiUserEvaluation.id);
|
2024-04-22 13:23:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*
|
|
|
|
|
* @summary รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*
|
|
|
|
|
* @param {string} id Guid, *Id รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Get("{id}")
|
|
|
|
|
async GetKpiUserEvaluationById(@Path() id: string) {
|
2024-04-26 13:08:23 +07:00
|
|
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
2024-04-22 13:23:31 +07:00
|
|
|
where: { id: id },
|
2024-04-26 10:18:00 +07:00
|
|
|
select: [
|
|
|
|
|
"id",
|
|
|
|
|
"profileId",
|
|
|
|
|
"prefix",
|
|
|
|
|
"firstName",
|
|
|
|
|
"lastName",
|
|
|
|
|
"kpiPeriodId",
|
|
|
|
|
"evaluationStatus",
|
|
|
|
|
"evaluationResults",
|
|
|
|
|
"createdAt",
|
2024-04-26 13:17:25 +07:00
|
|
|
"evaluatorId",
|
|
|
|
|
"commanderId",
|
|
|
|
|
"commanderHighId",
|
2024-04-26 17:39:24 +07:00
|
|
|
"plannedPoint",
|
|
|
|
|
"rolePoint",
|
|
|
|
|
"specialPoint",
|
|
|
|
|
"capacityPoint",
|
2024-04-26 10:18:00 +07:00
|
|
|
],
|
|
|
|
|
});
|
2024-04-26 13:08:23 +07:00
|
|
|
if (!kpiUserEvaluation) {
|
2024-04-22 13:23:31 +07:00
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-04-26 13:08:23 +07:00
|
|
|
return new HttpSuccess(kpiUserEvaluation);
|
2024-04-22 13:23:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*
|
|
|
|
|
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Get()
|
|
|
|
|
async listKpiUserEvaluation(
|
|
|
|
|
@Query("page") page: number = 1,
|
|
|
|
|
@Query("pageSize") pageSize: number = 10,
|
2024-04-22 15:24:44 +07:00
|
|
|
@Query("kpiPeriodId") kpiPeriodId?: string,
|
|
|
|
|
// @Query("keyword") keyword?: string,
|
2024-04-22 13:23:31 +07:00
|
|
|
) {
|
|
|
|
|
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
|
|
|
|
.createQueryBuilder("kpiUserEvaluation")
|
2024-04-26 10:18:00 +07:00
|
|
|
.andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
2024-04-26 12:40:43 +07:00
|
|
|
kpiPeriodId: kpiPeriodId,
|
2024-04-26 10:18:00 +07:00
|
|
|
})
|
2024-04-22 13:23:31 +07:00
|
|
|
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
|
|
|
|
.skip((page - 1) * pageSize)
|
|
|
|
|
.take(pageSize)
|
|
|
|
|
.getManyAndCount();
|
|
|
|
|
|
|
|
|
|
const mapData = kpiUserEvaluation.map((item) => ({
|
|
|
|
|
id: item.id,
|
|
|
|
|
profileId: item.profileId,
|
|
|
|
|
prefix: item.prefix,
|
|
|
|
|
firstname: item.firstName,
|
|
|
|
|
lastname: item.lastName,
|
|
|
|
|
kpiPeriodId: item.kpiPeriodId,
|
2024-04-22 15:24:44 +07:00
|
|
|
evaluationStatus: item.evaluationStatus,
|
|
|
|
|
evaluationResults: item.evaluationResults,
|
2024-04-26 13:17:25 +07:00
|
|
|
evaluatorId: item.evaluatorId,
|
|
|
|
|
commanderId: item.commanderId,
|
|
|
|
|
commanderHighId: item.commanderHighId,
|
2024-04-22 15:24:44 +07:00
|
|
|
createdAt: item.createdAt,
|
2024-04-26 17:39:24 +07:00
|
|
|
plannedPoint: item.plannedPoint,
|
|
|
|
|
rolePoint: item.rolePoint,
|
|
|
|
|
specialPoint: item.specialPoint,
|
|
|
|
|
capacityPoint: item.capacityPoint,
|
2024-04-22 13:23:31 +07:00
|
|
|
}));
|
|
|
|
|
return new HttpSuccess({ data: mapData, total });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API ลบรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
2024-04-26 10:18:00 +07:00
|
|
|
*
|
2024-04-22 13:23:31 +07:00
|
|
|
* @summary ลบรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
2024-04-26 10:18:00 +07:00
|
|
|
*
|
2024-04-22 13:23:31 +07:00
|
|
|
* @param {string} id Guid, *Id รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
|
|
|
|
*/
|
|
|
|
|
@Delete("{id}")
|
|
|
|
|
async deleteKpiUserEvaluation(@Path() id: string) {
|
2024-04-26 13:08:23 +07:00
|
|
|
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
2024-04-22 13:23:31 +07:00
|
|
|
where: { id: id },
|
|
|
|
|
});
|
2024-04-26 13:08:23 +07:00
|
|
|
if (!kpiUserEvaluation) {
|
2024-04-22 13:23:31 +07:00
|
|
|
throw new HttpError(
|
|
|
|
|
HttpStatusCode.NOT_FOUND,
|
|
|
|
|
"ไม่พบข้อมูลการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-04-26 13:08:23 +07:00
|
|
|
await this.kpiUserEvalutionRepository.remove(kpiUserEvaluation);
|
2024-04-22 13:23:31 +07:00
|
|
|
return new HttpSuccess();
|
|
|
|
|
}
|
|
|
|
|
}
|