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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 { Not } from "typeorm";
|
||||
|
||||
@Route("api/v1/kpi/user/achievement/Development")
|
||||
@Route("api/v1/kpi/user/achievement/evelopment")
|
||||
@Tags("KpiUserDevelopment")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
|
|
@ -149,103 +149,65 @@ import {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * API รายละเอียดพัฒนาตนเอง
|
||||
// *
|
||||
// * @summary - รายละเอียดพัฒนาตนเอง #
|
||||
// *
|
||||
// * @param {string} id Id พัฒนาตนเอง
|
||||
// */
|
||||
// @Get("{id}")
|
||||
// async GetKpiUserDevelopmentDetail(@Path() id: string) {
|
||||
// const getKpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
|
||||
// relations: ["kpiUserEvaluation"],
|
||||
// where: { id: id },
|
||||
// });
|
||||
// if (!getKpiUserDevelopment) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลพัฒนาตนเองนี้");
|
||||
// }
|
||||
/**
|
||||
* API รายละเอียดพัฒนาตนเอง
|
||||
*
|
||||
* @summary - รายละเอียดพัฒนาตนเอง #
|
||||
*
|
||||
* @param {string} id Id พัฒนาตนเอง
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetKpiUserDevelopmentDetail(@Path() id: string) {
|
||||
const getKpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
|
||||
relations: ["kpiUserEvaluation"],
|
||||
where: { id: id },
|
||||
});
|
||||
if (!getKpiUserDevelopment) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลพัฒนาตนเองนี้");
|
||||
}
|
||||
|
||||
// const mapKpiUserDevelopment = {
|
||||
// id: getKpiUserDevelopment.id,
|
||||
// evaluationId: getKpiUserDevelopment.kpiUserEvaluation.id,
|
||||
// including: getKpiUserDevelopment.including,
|
||||
// includingName: getKpiUserDevelopment.includingName,
|
||||
// target: getKpiUserDevelopment.target,
|
||||
// weight: getKpiUserDevelopment.weight,
|
||||
// unit: getKpiUserDevelopment.unit,
|
||||
// meaning: getKpiUserDevelopment.meaning,
|
||||
// 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,
|
||||
// };
|
||||
const mapKpiUserDevelopment = {
|
||||
id: getKpiUserDevelopment.id,
|
||||
evaluationId: getKpiUserDevelopment.kpiUserEvaluation.id,
|
||||
target: getKpiUserDevelopment.target,
|
||||
summary: getKpiUserDevelopment.summary,
|
||||
name: getKpiUserDevelopment.name,
|
||||
achievement10: getKpiUserDevelopment.achievement10,
|
||||
achievement5: getKpiUserDevelopment.achievement5,
|
||||
achievement0: getKpiUserDevelopment.achievement0,
|
||||
};
|
||||
|
||||
// return new HttpSuccess(mapKpiUserDevelopment);
|
||||
// }
|
||||
return new HttpSuccess(mapKpiUserDevelopment);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * API รายการพัฒนาตนเอง
|
||||
// *
|
||||
// * @summary - รายการพัฒนาตนเอง #
|
||||
// *
|
||||
// */
|
||||
// @Get()
|
||||
// async GetKpiUserDevelopment(@Query("id") id: string) {
|
||||
// const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.find({
|
||||
// where: {
|
||||
// kpiUserEvaluationId: id,
|
||||
// },
|
||||
// relations: ["kpiUserEvaluation"],
|
||||
// order: { createdAt: "ASC" },
|
||||
// });
|
||||
/**
|
||||
* API รายการพัฒนาตนเอง
|
||||
*
|
||||
* @summary - รายการพัฒนาตนเอง #
|
||||
*
|
||||
*/
|
||||
@Get()
|
||||
async GetKpiUserDevelopment(@Query("id") id: string) {
|
||||
const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.find({
|
||||
where: {
|
||||
kpiUserEvaluationId: id,
|
||||
},
|
||||
relations: ["kpiUserEvaluation"],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
||||
// const mapKpiUserDevelopment = kpiUserDevelopment.map((item) => ({
|
||||
// id: item.id,
|
||||
// evaluationId: item.kpiUserEvaluation.id,
|
||||
// including: item.including,
|
||||
// includingName: item.includingName,
|
||||
// target: item.target,
|
||||
// weight: item.weight,
|
||||
// unit: item.unit,
|
||||
// meaning: item.meaning,
|
||||
// formula: item.formula,
|
||||
// point: item.point,
|
||||
// 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);
|
||||
// }
|
||||
const mapKpiUserDevelopment = kpiUserDevelopment.map((item) => ({
|
||||
id: item.id,
|
||||
evaluationId: item.kpiUserEvaluation.id,
|
||||
target: item.target,
|
||||
summary: item.summary,
|
||||
name: item.name,
|
||||
achievement10: item.achievement10,
|
||||
achievement5: item.achievement5,
|
||||
achievement0: item.achievement0,
|
||||
}));
|
||||
return new HttpSuccess(mapKpiUserDevelopment);
|
||||
}
|
||||
|
||||
/**
|
||||
* API กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี
|
||||
|
|
|
|||
|
|
@ -196,6 +196,14 @@ export class KpiUserPlannedController extends Controller {
|
|||
unit: getKpiUserPlanned.unit,
|
||||
meaning: getKpiUserPlanned.meaning,
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -94,14 +94,6 @@ export class KpiUserRoleController extends Controller {
|
|||
kpiUserRole.createdFullName = request.user.name;
|
||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||
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);
|
||||
return new HttpSuccess(kpiUserRole.id);
|
||||
}
|
||||
|
|
@ -156,14 +148,6 @@ export class KpiUserRoleController extends Controller {
|
|||
|
||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||
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);
|
||||
await this.kpiUserRoleRepository.save(kpiUserRole);
|
||||
return new HttpSuccess(kpiUserRole.id);
|
||||
|
|
@ -214,6 +198,14 @@ export class KpiUserRoleController extends Controller {
|
|||
unit: getKpiUserRole.unit,
|
||||
meaning: getKpiUserRole.meaning,
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -84,13 +84,13 @@ export class KpiUserSpecialController extends Controller {
|
|||
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
|
||||
);
|
||||
}
|
||||
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||
where: {
|
||||
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);
|
||||
if (!kpiSpecial) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -105,9 +105,6 @@ export class KpiUserSpecialController extends Controller {
|
|||
kpiUserSpecial.createdFullName = request.user.name;
|
||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||
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);
|
||||
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: {
|
||||
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);
|
||||
if (!kpiSpecial) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -175,9 +172,6 @@ export class KpiUserSpecialController extends Controller {
|
|||
}
|
||||
kpiUserSpecial.lastUpdateUserId = request.user.sub;
|
||||
kpiUserSpecial.lastUpdateFullName = request.user.name;
|
||||
kpiUserSpecial.documentInfoEvidence = request.user.documentInfoEvidence;
|
||||
kpiUserSpecial.startDate = request.user.startDate;
|
||||
kpiUserSpecial.endDate = request.user.endDate;
|
||||
Object.assign(kpiUserSpecial, requestBody);
|
||||
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
|
||||
return new HttpSuccess(kpiUserSpecial.id);
|
||||
|
|
|
|||
|
|
@ -148,21 +148,21 @@ export class KpiSpecial extends EntityBase {
|
|||
formula: string;
|
||||
}
|
||||
|
||||
export class CreateKpiUserSpecial {
|
||||
export class CreateKpiSpecial {
|
||||
@Column()
|
||||
including: string | null;
|
||||
including: string;
|
||||
@Column()
|
||||
includingName: string | null;
|
||||
includingName: string;
|
||||
@Column()
|
||||
achievement1: string | null;
|
||||
achievement1: string;
|
||||
@Column()
|
||||
achievement2: string | null;
|
||||
achievement2: string;
|
||||
@Column()
|
||||
achievement3: string | null;
|
||||
achievement3: string;
|
||||
@Column()
|
||||
achievement4: string | null;
|
||||
achievement4: string;
|
||||
@Column()
|
||||
achievement5: string | null;
|
||||
achievement5: string;
|
||||
@Column()
|
||||
target: string;
|
||||
@Column()
|
||||
|
|
@ -175,23 +175,27 @@ export class CreateKpiUserSpecial {
|
|||
formula: string;
|
||||
@Column("uuid")
|
||||
kpiUserEvaluationId: string;
|
||||
@Column()
|
||||
period: string;
|
||||
@Column()
|
||||
year: string;
|
||||
}
|
||||
|
||||
export class UpdateKpiUserSpecial {
|
||||
export class UpdateKpiSpecial {
|
||||
@Column()
|
||||
including: string | null;
|
||||
including: string;
|
||||
@Column()
|
||||
includingName: string | null;
|
||||
includingName: string;
|
||||
@Column()
|
||||
achievement1: string | null;
|
||||
achievement1: string;
|
||||
@Column()
|
||||
achievement2: string | null;
|
||||
achievement2: string;
|
||||
@Column()
|
||||
achievement3: string | null;
|
||||
achievement3: string ;
|
||||
@Column()
|
||||
achievement4: string | null;
|
||||
achievement4: string;
|
||||
@Column()
|
||||
achievement5: string | null;
|
||||
achievement5: string;
|
||||
@Column()
|
||||
target: string;
|
||||
@Column()
|
||||
|
|
@ -204,6 +208,10 @@ export class UpdateKpiUserSpecial {
|
|||
formula: string;
|
||||
@Column("uuid")
|
||||
kpiUserEvaluationId: string;
|
||||
@Column()
|
||||
period: string;
|
||||
@Column()
|
||||
year: string;
|
||||
}
|
||||
|
||||
export class KpiUserSpecialDataPoint {
|
||||
|
|
|
|||
|
|
@ -87,58 +87,46 @@ export class KpiUserDevelopment extends EntityBase {
|
|||
|
||||
export class CreateKpiUserDevelopment {
|
||||
@Column()
|
||||
including: string | null;
|
||||
name: string | null;
|
||||
@Column()
|
||||
includingName: string | null;
|
||||
target: string | null;
|
||||
@Column()
|
||||
achievement1: string | null;
|
||||
summary?: number | null;
|
||||
@Column()
|
||||
achievement2: string | null;
|
||||
achievement10?: string | null;
|
||||
@Column()
|
||||
achievement3: string | null;
|
||||
achievement5?: string | null;
|
||||
@Column()
|
||||
achievement4: string | null;
|
||||
achievement0?: string | null;
|
||||
@Column()
|
||||
achievement5: string | null;
|
||||
isDevelopment70: boolean;
|
||||
@Column()
|
||||
target: string;
|
||||
isDevelopment20: boolean;
|
||||
@Column()
|
||||
unit: number;
|
||||
@Column()
|
||||
weight: number;
|
||||
@Column()
|
||||
meaning: string;
|
||||
@Column()
|
||||
formula: string;
|
||||
isDevelopment10: boolean;
|
||||
@Column("uuid")
|
||||
kpiUserEvaluationId: string;
|
||||
}
|
||||
|
||||
export class UpdateKpiUserDevelopment {
|
||||
@Column()
|
||||
including: string | null;
|
||||
name: string | null;
|
||||
@Column()
|
||||
includingName: string | null;
|
||||
target: string | null;
|
||||
@Column()
|
||||
achievement1: string | null;
|
||||
summary?: number | null;
|
||||
@Column()
|
||||
achievement2: string | null;
|
||||
achievement10?: string | null;
|
||||
@Column()
|
||||
achievement3: string | null;
|
||||
achievement5?: string | null;
|
||||
@Column()
|
||||
achievement4: string | null;
|
||||
achievement0?: string | null;
|
||||
@Column()
|
||||
achievement5: string | null;
|
||||
isDevelopment70: boolean;
|
||||
@Column()
|
||||
target: string;
|
||||
isDevelopment20: boolean;
|
||||
@Column()
|
||||
unit: number;
|
||||
@Column()
|
||||
weight: number;
|
||||
@Column()
|
||||
meaning: string;
|
||||
@Column()
|
||||
formula: string;
|
||||
isDevelopment10: boolean;
|
||||
@Column("uuid")
|
||||
kpiUserEvaluationId: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue