Merge branch 'develop' of github.com:Frappet/bma-ehr-kpi into develop
This commit is contained in:
commit
e7db2fab31
9 changed files with 371 additions and 168 deletions
|
|
@ -593,4 +593,22 @@ export class kpiPlanController extends Controller {
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ประวัดิตัวชี้วัดิตามแผน
|
||||||
|
* @param id Guid, *Id ประวัดิตัวชี้วัดตามแผน
|
||||||
|
*/
|
||||||
|
@Get("history/{id}")
|
||||||
|
async GetHistory(@Path() id: string) {
|
||||||
|
const kpiPlanHistory = await this.kpiPlanHistoryRepository.find({
|
||||||
|
where: { kpiPlanId: id },
|
||||||
|
order:{
|
||||||
|
createdAt: "ASC"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!kpiPlanHistory) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประวัดิตัวชี้วัดตามแผนนี้");
|
||||||
|
}
|
||||||
|
return new HttpSuccess(kpiPlanHistory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -551,4 +551,22 @@ export class kpiRoleController extends Controller {
|
||||||
}
|
}
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ประวัดิตัวชี้วัดตามตำแหน่ง
|
||||||
|
* @param id Guid, *Id ประวัดิตัวชี้วัดตามตำแหน่ง
|
||||||
|
*/
|
||||||
|
@Get("history/{id}")
|
||||||
|
async GetHistory(@Path() id: string) {
|
||||||
|
const kpiRoleHistory = await this.kpiRoleHistoryRepository.find({
|
||||||
|
where: { kpiRoleId: id },
|
||||||
|
order:{
|
||||||
|
createdAt: "ASC"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!kpiRoleHistory) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประวัดิตัวชี้วัดตามตำแหน่งนี้");
|
||||||
|
}
|
||||||
|
return new HttpSuccess(kpiRoleHistory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
215
src/controllers/KpiSpecialController.ts
Normal file
215
src/controllers/KpiSpecialController.ts
Normal file
|
|
@ -0,0 +1,215 @@
|
||||||
|
import {
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Post,
|
||||||
|
Put,
|
||||||
|
Delete,
|
||||||
|
Route,
|
||||||
|
Security,
|
||||||
|
Tags,
|
||||||
|
Body,
|
||||||
|
Path,
|
||||||
|
Request,
|
||||||
|
Example,
|
||||||
|
SuccessResponse,
|
||||||
|
Response,
|
||||||
|
Query,
|
||||||
|
} 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 { KpiSpecial, CreateKpiSpecial, UpdateKpiSpecial } from "../entities/kpiSpecial";
|
||||||
|
import CallAPI from "../interfaces/call-api";
|
||||||
|
import { Brackets, IsNull, Like, Not } from "typeorm";
|
||||||
|
|
||||||
|
@Route("api/v1/kpi/special")
|
||||||
|
@Tags("kpiSpecial")
|
||||||
|
@Security("bearerAuth")
|
||||||
|
@Response(
|
||||||
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
|
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||||
|
)
|
||||||
|
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||||
|
export class kpiSpecialController extends Controller {
|
||||||
|
private kpiSpecialRepository = AppDataSource.getRepository(KpiSpecial);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* สร้างตัวชี้วัด Special
|
||||||
|
* @param requestBody
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
@Post()
|
||||||
|
async createKpiSpecial(
|
||||||
|
@Body() requestBody: CreateKpiSpecial,
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
|
where: {
|
||||||
|
including: String(requestBody.including),
|
||||||
|
includingName: String(requestBody.includingName),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if(chk_kpiSpecial){
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.CONFLICT,
|
||||||
|
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const kpiSpecial = Object.assign(new KpiSpecial(), requestBody);
|
||||||
|
if (!kpiSpecial) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
}
|
||||||
|
kpiSpecial.createdUserId = request.user.sub;
|
||||||
|
kpiSpecial.createdFullName = request.user.name;
|
||||||
|
kpiSpecial.lastUpdateUserId = request.user.sub;
|
||||||
|
kpiSpecial.lastUpdateFullName = request.user.name;
|
||||||
|
await this.kpiSpecialRepository.save(kpiSpecial);
|
||||||
|
return new HttpSuccess(kpiSpecial.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API แก้ไขตัวชี้วัด Special
|
||||||
|
* @param id
|
||||||
|
* @param requestBody
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
@Put("{id}")
|
||||||
|
async updateKpiSpecial(
|
||||||
|
@Path() id: string,
|
||||||
|
@Body() requestBody: UpdateKpiSpecial,
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
const kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
});
|
||||||
|
if (!kpiSpecial) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัด Specialนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: Not(id),
|
||||||
|
including: String(requestBody.including),
|
||||||
|
includingName: String(requestBody.includingName),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if(chk_kpiSpecial){
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.CONFLICT,
|
||||||
|
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
kpiSpecial.lastUpdateUserId = request.user.sub;
|
||||||
|
kpiSpecial.lastUpdateFullName = request.user.name;
|
||||||
|
this.kpiSpecialRepository.merge(kpiSpecial, requestBody);
|
||||||
|
await this.kpiSpecialRepository.save(kpiSpecial);
|
||||||
|
return new HttpSuccess(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ตัวชี้วัด Special
|
||||||
|
* @param id Guid, *Id ตัวชี้วัด Special
|
||||||
|
*/
|
||||||
|
@Get("{id}")
|
||||||
|
async GetKpiSpecialById(@Path() id: string) {
|
||||||
|
const KpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
|
where: { id: id }
|
||||||
|
});
|
||||||
|
if (!KpiSpecial) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัด Specialนี้");
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapData = {
|
||||||
|
id: KpiSpecial.id,
|
||||||
|
period: KpiSpecial.period,
|
||||||
|
year: KpiSpecial.year,
|
||||||
|
including: KpiSpecial.including,
|
||||||
|
includingName: KpiSpecial.includingName,
|
||||||
|
target: KpiSpecial.target,
|
||||||
|
unit: KpiSpecial.unit,
|
||||||
|
weight: KpiSpecial.weight,
|
||||||
|
point: KpiSpecial.point,
|
||||||
|
summary: KpiSpecial.summary,
|
||||||
|
documentInfoEvidence: KpiSpecial.documentInfoEvidence,
|
||||||
|
startDate: KpiSpecial.startDate,
|
||||||
|
endDate: KpiSpecial.endDate,
|
||||||
|
achievement1: KpiSpecial.achievement1,
|
||||||
|
achievement2: KpiSpecial.achievement2,
|
||||||
|
achievement3: KpiSpecial.achievement3,
|
||||||
|
achievement4: KpiSpecial.achievement4,
|
||||||
|
achievement5: KpiSpecial.achievement5,
|
||||||
|
meaning: KpiSpecial.meaning,
|
||||||
|
formula: KpiSpecial.formula,
|
||||||
|
};
|
||||||
|
return new HttpSuccess(mapData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API list ตัวชี้วัด Special
|
||||||
|
* @param page
|
||||||
|
* @param pageSize
|
||||||
|
* @param keyword
|
||||||
|
*/
|
||||||
|
@Get()
|
||||||
|
async listKpiSpecial(
|
||||||
|
@Query("page") page: number = 1,
|
||||||
|
@Query("pageSize") pageSize: number = 10,
|
||||||
|
@Query("keyword") keyword?: string,
|
||||||
|
) {
|
||||||
|
let whereClause: any = {};
|
||||||
|
if (keyword !== undefined && keyword !== "") {
|
||||||
|
whereClause = {
|
||||||
|
where: [{
|
||||||
|
including: Like(`%${keyword}%`),
|
||||||
|
includingName: Like(`%${keyword}%`),
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const [kpiSpecial, total] = await this.kpiSpecialRepository.findAndCount({
|
||||||
|
...whereClause,
|
||||||
|
...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
|
});
|
||||||
|
const mapData = kpiSpecial.map((KpiSpecial) => ({
|
||||||
|
id: KpiSpecial.id,
|
||||||
|
period: KpiSpecial.period,
|
||||||
|
year: KpiSpecial.year,
|
||||||
|
including: KpiSpecial.including,
|
||||||
|
includingName: KpiSpecial.includingName,
|
||||||
|
target: KpiSpecial.target,
|
||||||
|
unit: KpiSpecial.unit,
|
||||||
|
weight: KpiSpecial.weight,
|
||||||
|
point: KpiSpecial.point,
|
||||||
|
summary: KpiSpecial.summary,
|
||||||
|
documentInfoEvidence: KpiSpecial.documentInfoEvidence,
|
||||||
|
startDate: KpiSpecial.startDate,
|
||||||
|
endDate: KpiSpecial.endDate,
|
||||||
|
achievement1: KpiSpecial.achievement1,
|
||||||
|
achievement2: KpiSpecial.achievement2,
|
||||||
|
achievement3: KpiSpecial.achievement3,
|
||||||
|
achievement4: KpiSpecial.achievement4,
|
||||||
|
achievement5: KpiSpecial.achievement5,
|
||||||
|
meaning: KpiSpecial.meaning,
|
||||||
|
formula: KpiSpecial.formula,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess({ data: mapData, total });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ลบตัวชี้วัด Special
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@Delete("{id}")
|
||||||
|
async deleteKpiSpecial(@Path() id: string) {
|
||||||
|
const kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
});
|
||||||
|
if (!kpiSpecial) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัด Specialนี้");
|
||||||
|
}
|
||||||
|
await this.kpiSpecialRepository.remove(kpiSpecial);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ import {
|
||||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||||
import { Not } from "typeorm";
|
import { Not } from "typeorm";
|
||||||
|
|
||||||
@Route("api/v1/kpi/user/achievement/Development")
|
@Route("api/v1/kpi/user/achievement/evelopment")
|
||||||
@Tags("KpiUserDevelopment")
|
@Tags("KpiUserDevelopment")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
@Response(
|
@Response(
|
||||||
|
|
@ -149,103 +149,65 @@ import {
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * API รายละเอียดพัฒนาตนเอง
|
* API รายละเอียดพัฒนาตนเอง
|
||||||
// *
|
*
|
||||||
// * @summary - รายละเอียดพัฒนาตนเอง #
|
* @summary - รายละเอียดพัฒนาตนเอง #
|
||||||
// *
|
*
|
||||||
// * @param {string} id Id พัฒนาตนเอง
|
* @param {string} id Id พัฒนาตนเอง
|
||||||
// */
|
*/
|
||||||
// @Get("{id}")
|
@Get("{id}")
|
||||||
// async GetKpiUserDevelopmentDetail(@Path() id: string) {
|
async GetKpiUserDevelopmentDetail(@Path() id: string) {
|
||||||
// const getKpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
|
const getKpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
|
||||||
// relations: ["kpiUserEvaluation"],
|
relations: ["kpiUserEvaluation"],
|
||||||
// where: { id: id },
|
where: { id: id },
|
||||||
// });
|
});
|
||||||
// if (!getKpiUserDevelopment) {
|
if (!getKpiUserDevelopment) {
|
||||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลพัฒนาตนเองนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลพัฒนาตนเองนี้");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const mapKpiUserDevelopment = {
|
const mapKpiUserDevelopment = {
|
||||||
// id: getKpiUserDevelopment.id,
|
id: getKpiUserDevelopment.id,
|
||||||
// evaluationId: getKpiUserDevelopment.kpiUserEvaluation.id,
|
evaluationId: getKpiUserDevelopment.kpiUserEvaluation.id,
|
||||||
// including: getKpiUserDevelopment.including,
|
target: getKpiUserDevelopment.target,
|
||||||
// includingName: getKpiUserDevelopment.includingName,
|
summary: getKpiUserDevelopment.summary,
|
||||||
// target: getKpiUserDevelopment.target,
|
name: getKpiUserDevelopment.name,
|
||||||
// weight: getKpiUserDevelopment.weight,
|
achievement10: getKpiUserDevelopment.achievement10,
|
||||||
// unit: getKpiUserDevelopment.unit,
|
achievement5: getKpiUserDevelopment.achievement5,
|
||||||
// meaning: getKpiUserDevelopment.meaning,
|
achievement0: getKpiUserDevelopment.achievement0,
|
||||||
// formula: getKpiUserDevelopment.formula,
|
};
|
||||||
// point: getKpiUserDevelopment.point,
|
|
||||||
// achievement:
|
|
||||||
// getKpiUserDevelopment.point === 1
|
|
||||||
// ? getKpiUserDevelopment.achievement1
|
|
||||||
// : getKpiUserDevelopment.point === 2
|
|
||||||
// ? getKpiUserDevelopment.achievement2
|
|
||||||
// : getKpiUserDevelopment.point === 3
|
|
||||||
// ? getKpiUserDevelopment.achievement3
|
|
||||||
// : getKpiUserDevelopment.point === 4
|
|
||||||
// ? getKpiUserDevelopment.achievement4
|
|
||||||
// : getKpiUserDevelopment.point === 5
|
|
||||||
// ? getKpiUserDevelopment.achievement5
|
|
||||||
// : null,
|
|
||||||
// achievement1: getKpiUserDevelopment.achievement1,
|
|
||||||
// achievement2: getKpiUserDevelopment.achievement2,
|
|
||||||
// achievement3: getKpiUserDevelopment.achievement3,
|
|
||||||
// achievement4: getKpiUserDevelopment.achievement4,
|
|
||||||
// achievement5: getKpiUserDevelopment.achievement5,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// return new HttpSuccess(mapKpiUserDevelopment);
|
return new HttpSuccess(mapKpiUserDevelopment);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * API รายการพัฒนาตนเอง
|
* API รายการพัฒนาตนเอง
|
||||||
// *
|
*
|
||||||
// * @summary - รายการพัฒนาตนเอง #
|
* @summary - รายการพัฒนาตนเอง #
|
||||||
// *
|
*
|
||||||
// */
|
*/
|
||||||
// @Get()
|
@Get()
|
||||||
// async GetKpiUserDevelopment(@Query("id") id: string) {
|
async GetKpiUserDevelopment(@Query("id") id: string) {
|
||||||
// const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.find({
|
const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.find({
|
||||||
// where: {
|
where: {
|
||||||
// kpiUserEvaluationId: id,
|
kpiUserEvaluationId: id,
|
||||||
// },
|
},
|
||||||
// relations: ["kpiUserEvaluation"],
|
relations: ["kpiUserEvaluation"],
|
||||||
// order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// const mapKpiUserDevelopment = kpiUserDevelopment.map((item) => ({
|
const mapKpiUserDevelopment = kpiUserDevelopment.map((item) => ({
|
||||||
// id: item.id,
|
id: item.id,
|
||||||
// evaluationId: item.kpiUserEvaluation.id,
|
evaluationId: item.kpiUserEvaluation.id,
|
||||||
// including: item.including,
|
target: item.target,
|
||||||
// includingName: item.includingName,
|
summary: item.summary,
|
||||||
// target: item.target,
|
name: item.name,
|
||||||
// weight: item.weight,
|
achievement10: item.achievement10,
|
||||||
// unit: item.unit,
|
achievement5: item.achievement5,
|
||||||
// meaning: item.meaning,
|
achievement0: item.achievement0,
|
||||||
// formula: item.formula,
|
}));
|
||||||
// point: item.point,
|
return new HttpSuccess(mapKpiUserDevelopment);
|
||||||
// achievement:
|
}
|
||||||
// item.point === 1
|
|
||||||
// ? item.achievement1
|
|
||||||
// : item.point === 2
|
|
||||||
// ? item.achievement2
|
|
||||||
// : item.point === 3
|
|
||||||
// ? item.achievement3
|
|
||||||
// : item.point === 4
|
|
||||||
// ? item.achievement4
|
|
||||||
// : item.point === 5
|
|
||||||
// ? item.achievement5
|
|
||||||
// : null,
|
|
||||||
// achievement1: item.achievement1,
|
|
||||||
// achievement2: item.achievement2,
|
|
||||||
// achievement3: item.achievement3,
|
|
||||||
// achievement4: item.achievement4,
|
|
||||||
// achievement5: item.achievement5,
|
|
||||||
// }));
|
|
||||||
// return new HttpSuccess(mapKpiUserDevelopment);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี
|
* API กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,14 @@ export class KpiUserPlannedController extends Controller {
|
||||||
unit: getKpiUserPlanned.unit,
|
unit: getKpiUserPlanned.unit,
|
||||||
meaning: getKpiUserPlanned.meaning,
|
meaning: getKpiUserPlanned.meaning,
|
||||||
formula: getKpiUserPlanned.formula,
|
formula: getKpiUserPlanned.formula,
|
||||||
|
achievement1: getKpiUserPlanned.achievement1,
|
||||||
|
achievement2: getKpiUserPlanned.achievement2,
|
||||||
|
achievement3: getKpiUserPlanned.achievement3,
|
||||||
|
achievement4: getKpiUserPlanned.achievement4,
|
||||||
|
achievement5: getKpiUserPlanned.achievement5,
|
||||||
|
documentInfoEvidence: getKpiUserPlanned.documentInfoEvidence,
|
||||||
|
endDate: getKpiUserPlanned.endDate,
|
||||||
|
startDate: getKpiUserPlanned.startDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new HttpSuccess(mapGetKpiUserPlanned);
|
return new HttpSuccess(mapGetKpiUserPlanned);
|
||||||
|
|
|
||||||
|
|
@ -94,14 +94,6 @@ export class KpiUserRoleController extends Controller {
|
||||||
kpiUserRole.createdFullName = request.user.name;
|
kpiUserRole.createdFullName = request.user.name;
|
||||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||||
kpiUserRole.lastUpdateFullName = request.user.name;
|
kpiUserRole.lastUpdateFullName = request.user.name;
|
||||||
kpiUserRole.documentInfoEvidence = request.user.documentInfoEvidence;
|
|
||||||
kpiUserRole.startDate = request.user.startDate;
|
|
||||||
kpiUserRole.endDate = request.user.endDate;
|
|
||||||
kpiUserRole.achievement1 = request.user.achievement1;
|
|
||||||
kpiUserRole.achievement2 = request.user.achievement2;
|
|
||||||
kpiUserRole.achievement3 = request.user.achievement3;
|
|
||||||
kpiUserRole.achievement4 = request.user.achievement4;
|
|
||||||
kpiUserRole.achievement5 = request.user.achievement5;
|
|
||||||
await this.kpiUserRoleRepository.save(kpiUserRole);
|
await this.kpiUserRoleRepository.save(kpiUserRole);
|
||||||
return new HttpSuccess(kpiUserRole.id);
|
return new HttpSuccess(kpiUserRole.id);
|
||||||
}
|
}
|
||||||
|
|
@ -156,14 +148,6 @@ export class KpiUserRoleController extends Controller {
|
||||||
|
|
||||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||||
kpiUserRole.lastUpdateFullName = request.user.name;
|
kpiUserRole.lastUpdateFullName = request.user.name;
|
||||||
kpiUserRole.documentInfoEvidence = request.user.documentInfoEvidence;
|
|
||||||
kpiUserRole.startDate = request.user.startDate;
|
|
||||||
kpiUserRole.endDate = request.user.endDate;
|
|
||||||
kpiUserRole.achievement1 = request.user.achievement1;
|
|
||||||
kpiUserRole.achievement2 = request.user.achievement2;
|
|
||||||
kpiUserRole.achievement3 = request.user.achievement3;
|
|
||||||
kpiUserRole.achievement4 = request.user.achievement4;
|
|
||||||
kpiUserRole.achievement5 = request.user.achievement5;
|
|
||||||
this.kpiUserRoleRepository.merge(kpiUserRole, requestBody);
|
this.kpiUserRoleRepository.merge(kpiUserRole, requestBody);
|
||||||
await this.kpiUserRoleRepository.save(kpiUserRole);
|
await this.kpiUserRoleRepository.save(kpiUserRole);
|
||||||
return new HttpSuccess(kpiUserRole.id);
|
return new HttpSuccess(kpiUserRole.id);
|
||||||
|
|
@ -214,6 +198,14 @@ export class KpiUserRoleController extends Controller {
|
||||||
unit: getKpiUserRole.unit,
|
unit: getKpiUserRole.unit,
|
||||||
meaning: getKpiUserRole.meaning,
|
meaning: getKpiUserRole.meaning,
|
||||||
formula: getKpiUserRole.formula,
|
formula: getKpiUserRole.formula,
|
||||||
|
achievement1: getKpiUserRole.achievement1,
|
||||||
|
achievement2: getKpiUserRole.achievement2,
|
||||||
|
achievement3: getKpiUserRole.achievement3,
|
||||||
|
achievement4: getKpiUserRole.achievement4,
|
||||||
|
achievement5: getKpiUserRole.achievement5,
|
||||||
|
documentInfoEvidence: getKpiUserRole.documentInfoEvidence,
|
||||||
|
endDate: getKpiUserRole.endDate,
|
||||||
|
startDate: getKpiUserRole.startDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return new HttpSuccess(mapKpiUserRole);
|
return new HttpSuccess(mapKpiUserRole);
|
||||||
|
|
|
||||||
|
|
@ -84,13 +84,13 @@ export class KpiUserSpecialController extends Controller {
|
||||||
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
including: String(requestBody.including),
|
including: String(requestBody.including),
|
||||||
includingName: String(requestBody.includingName)
|
includingName: String(requestBody.includingName),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if(!chk_kpiSpecial){
|
if (!chk_kpiSpecial) {
|
||||||
const kpiSpecial = Object.assign(new KpiSpecial(), requestBody);
|
const kpiSpecial = Object.assign(new KpiSpecial(), requestBody);
|
||||||
if (!kpiSpecial) {
|
if (!kpiSpecial) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -105,9 +105,6 @@ export class KpiUserSpecialController extends Controller {
|
||||||
kpiUserSpecial.createdFullName = request.user.name;
|
kpiUserSpecial.createdFullName = request.user.name;
|
||||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||||
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
||||||
kpiUserSpecial.documentInfoEvidence = request.user.documentInfoEvidence;
|
|
||||||
kpiUserSpecial.startDate = request.user.startDate;
|
|
||||||
kpiUserSpecial.endDate = request.user.endDate;
|
|
||||||
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
|
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
|
||||||
return new HttpSuccess(kpiUserSpecial.id);
|
return new HttpSuccess(kpiUserSpecial.id);
|
||||||
}
|
}
|
||||||
|
|
@ -156,13 +153,13 @@ export class KpiUserSpecialController extends Controller {
|
||||||
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
including: String(requestBody.including),
|
including: String(requestBody.including),
|
||||||
includingName: String(requestBody.includingName)
|
includingName: String(requestBody.includingName),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if(!chk_kpiSpecial){
|
if (!chk_kpiSpecial) {
|
||||||
const kpiSpecial = Object.assign(new KpiSpecial(), requestBody);
|
const kpiSpecial = Object.assign(new KpiSpecial(), requestBody);
|
||||||
if (!kpiSpecial) {
|
if (!kpiSpecial) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -175,9 +172,6 @@ export class KpiUserSpecialController extends Controller {
|
||||||
}
|
}
|
||||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||||
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
||||||
kpiUserSpecial.documentInfoEvidence = request.user.documentInfoEvidence;
|
|
||||||
kpiUserSpecial.startDate = request.user.startDate;
|
|
||||||
kpiUserSpecial.endDate = request.user.endDate;
|
|
||||||
Object.assign(kpiUserSpecial, requestBody);
|
Object.assign(kpiUserSpecial, requestBody);
|
||||||
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
|
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
|
||||||
return new HttpSuccess(kpiUserSpecial.id);
|
return new HttpSuccess(kpiUserSpecial.id);
|
||||||
|
|
|
||||||
|
|
@ -148,21 +148,21 @@ export class KpiSpecial extends EntityBase {
|
||||||
formula: string;
|
formula: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateKpiUserSpecial {
|
export class CreateKpiSpecial {
|
||||||
@Column()
|
@Column()
|
||||||
including: string | null;
|
including: string;
|
||||||
@Column()
|
@Column()
|
||||||
includingName: string | null;
|
includingName: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement1: string | null;
|
achievement1: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement2: string | null;
|
achievement2: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement3: string | null;
|
achievement3: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement4: string | null;
|
achievement4: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement5: string | null;
|
achievement5: string;
|
||||||
@Column()
|
@Column()
|
||||||
target: string;
|
target: string;
|
||||||
@Column()
|
@Column()
|
||||||
|
|
@ -175,23 +175,27 @@ export class CreateKpiUserSpecial {
|
||||||
formula: string;
|
formula: string;
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
|
@Column()
|
||||||
|
period: string;
|
||||||
|
@Column()
|
||||||
|
year: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateKpiUserSpecial {
|
export class UpdateKpiSpecial {
|
||||||
@Column()
|
@Column()
|
||||||
including: string | null;
|
including: string;
|
||||||
@Column()
|
@Column()
|
||||||
includingName: string | null;
|
includingName: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement1: string | null;
|
achievement1: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement2: string | null;
|
achievement2: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement3: string | null;
|
achievement3: string ;
|
||||||
@Column()
|
@Column()
|
||||||
achievement4: string | null;
|
achievement4: string;
|
||||||
@Column()
|
@Column()
|
||||||
achievement5: string | null;
|
achievement5: string;
|
||||||
@Column()
|
@Column()
|
||||||
target: string;
|
target: string;
|
||||||
@Column()
|
@Column()
|
||||||
|
|
@ -204,6 +208,10 @@ export class UpdateKpiUserSpecial {
|
||||||
formula: string;
|
formula: string;
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
|
@Column()
|
||||||
|
period: string;
|
||||||
|
@Column()
|
||||||
|
year: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class KpiUserSpecialDataPoint {
|
export class KpiUserSpecialDataPoint {
|
||||||
|
|
|
||||||
|
|
@ -87,58 +87,46 @@ export class KpiUserDevelopment extends EntityBase {
|
||||||
|
|
||||||
export class CreateKpiUserDevelopment {
|
export class CreateKpiUserDevelopment {
|
||||||
@Column()
|
@Column()
|
||||||
including: string | null;
|
name: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
includingName: string | null;
|
target: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement1: string | null;
|
summary?: number | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement2: string | null;
|
achievement10?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement3: string | null;
|
achievement5?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement4: string | null;
|
achievement0?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement5: string | null;
|
isDevelopment70: boolean;
|
||||||
@Column()
|
@Column()
|
||||||
target: string;
|
isDevelopment20: boolean;
|
||||||
@Column()
|
@Column()
|
||||||
unit: number;
|
isDevelopment10: boolean;
|
||||||
@Column()
|
|
||||||
weight: number;
|
|
||||||
@Column()
|
|
||||||
meaning: string;
|
|
||||||
@Column()
|
|
||||||
formula: string;
|
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateKpiUserDevelopment {
|
export class UpdateKpiUserDevelopment {
|
||||||
@Column()
|
@Column()
|
||||||
including: string | null;
|
name: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
includingName: string | null;
|
target: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement1: string | null;
|
summary?: number | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement2: string | null;
|
achievement10?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement3: string | null;
|
achievement5?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement4: string | null;
|
achievement0?: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
achievement5: string | null;
|
isDevelopment70: boolean;
|
||||||
@Column()
|
@Column()
|
||||||
target: string;
|
isDevelopment20: boolean;
|
||||||
@Column()
|
@Column()
|
||||||
unit: number;
|
isDevelopment10: boolean;
|
||||||
@Column()
|
|
||||||
weight: number;
|
|
||||||
@Column()
|
|
||||||
meaning: string;
|
|
||||||
@Column()
|
|
||||||
formula: string;
|
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue