api งานที่ได้รับมอบหมายพิเศษ

This commit is contained in:
Kittapath 2024-04-23 17:55:57 +07:00
parent 5db5f445c8
commit 55ceeac3d9
4 changed files with 415 additions and 93 deletions

View file

@ -19,7 +19,12 @@ import {
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import { KpiUserPlanned, CreateKpiUserPlanned, UpdateKpiUserPlanned, KpiUserPlannedDataPoint } from "../entities/kpiUserPlanned"; import {
KpiUserPlanned,
CreateKpiUserPlanned,
UpdateKpiUserPlanned,
KpiUserPlannedDataPoint,
} from "../entities/kpiUserPlanned";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { Not } from "typeorm"; import { Not } from "typeorm";
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation"; import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
@ -51,15 +56,15 @@ export class KpiUserPlannedController extends Controller {
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
) { ) {
const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({ const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({
where:{id:requestBody.kpiUserEvaluationId}, where: { id: requestBody.kpiUserEvaluationId },
}) });
if (!chkUserEvaluation) { if (!chkUserEvaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน");
} }
const chkKpiPlan = await this.kpiPlanRepository.findOne({ const chkKpiPlan = await this.kpiPlanRepository.findOne({
where:{id:requestBody.kpiPlanId}, where: { id: requestBody.kpiPlanId },
}) });
if (!chkKpiPlan) { if (!chkKpiPlan) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินตามแผน"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินตามแผน");
} }
@ -129,14 +134,14 @@ export class KpiUserPlannedController extends Controller {
@Get("{id}") @Get("{id}")
async GetKpiUserPlannedDetail(@Path() id: string) { async GetKpiUserPlannedDetail(@Path() id: string) {
const getKpiUserPlanned = await this.kpiUserPlannedRepository.findOne({ const getKpiUserPlanned = await this.kpiUserPlannedRepository.findOne({
relations: ["kpiPlan","kpiUserEvaluation"], relations: ["kpiPlan", "kpiUserEvaluation"],
where: { id: id }, where: { id: id },
}); });
if (!getKpiUserPlanned) { if (!getKpiUserPlanned) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามแผนปฏิบัติราชการประจำปีนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามแผนปฏิบัติราชการประจำปีนี้");
} }
const mapGetKpiUserPlanned = ({ const mapGetKpiUserPlanned = {
id: getKpiUserPlanned.id, id: getKpiUserPlanned.id,
evaluationId: getKpiUserPlanned.kpiUserEvaluation.id, evaluationId: getKpiUserPlanned.kpiUserEvaluation.id,
kpiPlanId: getKpiUserPlanned.kpiPlan.id, kpiPlanId: getKpiUserPlanned.kpiPlan.id,
@ -147,7 +152,7 @@ export class KpiUserPlannedController extends Controller {
unit: getKpiUserPlanned.unit, unit: getKpiUserPlanned.unit,
meaning: getKpiUserPlanned.meaning, meaning: getKpiUserPlanned.meaning,
formula: getKpiUserPlanned.formula, formula: getKpiUserPlanned.formula,
}); };
return new HttpSuccess(mapGetKpiUserPlanned); return new HttpSuccess(mapGetKpiUserPlanned);
} }
@ -159,14 +164,12 @@ export class KpiUserPlannedController extends Controller {
* *
*/ */
@Get() @Get()
async GetKpiUserPlanned( async GetKpiUserPlanned(@Query("id") id: string) {
@Query("id") id: string ,
) {
const kpiUserPlanned = await this.kpiUserPlannedRepository.find({ const kpiUserPlanned = await this.kpiUserPlannedRepository.find({
where:{ where: {
kpiUserEvaluationId:id kpiUserEvaluationId: id,
}, },
relations: ["kpiPlan","kpiUserEvaluation"], relations: ["kpiPlan", "kpiUserEvaluation"],
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
}); });
@ -181,11 +184,18 @@ export class KpiUserPlannedController extends Controller {
meaning: item.meaning, meaning: item.meaning,
formula: item.formula, formula: item.formula,
point: item.point, point: item.point,
achievement: item.point === 1 ? "ระดับ 1" : achievement:
item.point === 2 ? "ระดับ 2" : item.point === 1
item.point === 3 ? "ระดับ 3" : ? item.kpiPlan.achievement1
item.point === 4 ? "ระดับ 4" : : item.point === 2
item.point === 5 ? "ระดับ 5" : null, ? item.kpiPlan.achievement2
: item.point === 3
? item.kpiPlan.achievement3
: item.point === 4
? item.kpiPlan.achievement4
: item.point === 5
? item.kpiPlan.achievement5
: null,
achievement1: item.kpiPlan.achievement1, achievement1: item.kpiPlan.achievement1,
achievement2: item.kpiPlan.achievement2, achievement2: item.kpiPlan.achievement2,
achievement3: item.kpiPlan.achievement3, achievement3: item.kpiPlan.achievement3,
@ -202,24 +212,26 @@ export class KpiUserPlannedController extends Controller {
* *
* *
*/ */
@Post("point") @Post("point")
async CreateKpiUserPlannedPoint( async CreateKpiUserPlannedPoint(
@Body() requestBody: KpiUserPlannedDataPoint[], @Body() requestBody: KpiUserPlannedDataPoint[],
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
){ ) {
for (const item of requestBody) {
for (const item of requestBody) { const kpiUserPlanned = await this.kpiUserPlannedRepository.findOne({
const kpiUserPlanned = await this.kpiUserPlannedRepository.findOne({ where: { id: item.id },
where: { id: item.id }, });
}); if (!kpiUserPlanned) {
if (!kpiUserPlanned) { throw new HttpError(
throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลงานตามแผนปฏิบัติราชการประจำปีนี้: ${item.id}`); HttpStatusCode.NOT_FOUND,
} `ไม่พบข้อมูลงานตามแผนปฏิบัติราชการประจำปีนี้: ${item.id}`,
this.kpiUserPlannedRepository.merge(kpiUserPlanned, item); );
kpiUserPlanned.lastUpdateUserId = request.user.sub;
kpiUserPlanned.lastUpdateFullName = request.user.name;
await this.kpiUserPlannedRepository.save(kpiUserPlanned);
} }
return new HttpSuccess(); this.kpiUserPlannedRepository.merge(kpiUserPlanned, item);
kpiUserPlanned.lastUpdateUserId = request.user.sub;
kpiUserPlanned.lastUpdateFullName = request.user.name;
await this.kpiUserPlannedRepository.save(kpiUserPlanned);
} }
return new HttpSuccess();
}
} }

View file

@ -19,7 +19,12 @@ import {
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status"; import HttpStatusCode from "../interfaces/http-status";
import { KpiUserRole, CreateKpiUserRole, UpdateKpiUserRole, KpiUserRoleDataPoint } from "../entities/kpiUserRole"; import {
KpiUserRole,
CreateKpiUserRole,
UpdateKpiUserRole,
KpiUserRoleDataPoint,
} from "../entities/kpiUserRole";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { Not } from "typeorm"; import { Not } from "typeorm";
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation"; import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
@ -51,17 +56,20 @@ export class KpiUserRoleController extends Controller {
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
) { ) {
const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({ const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({
where:{id:requestBody.kpiUserEvaluationId}, where: { id: requestBody.kpiUserEvaluationId },
}) });
if (!chkUserEvaluation) { if (!chkUserEvaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน");
} }
const chkKpiRole = await this.kpiRoleRepository.findOne({ const chkKpiRole = await this.kpiRoleRepository.findOne({
where:{id:requestBody.kpiRoleId}, where: { id: requestBody.kpiRoleId },
}) });
if (!chkKpiRole) { if (!chkKpiRole) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินตามหน้าที่ความรับผิดชอบหลัก"); throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลแบบประเมินตามหน้าที่ความรับผิดชอบหลัก",
);
} }
const kpiUserRole = Object.assign(new KpiUserRole(), requestBody); const kpiUserRole = Object.assign(new KpiUserRole(), requestBody);
@ -95,17 +103,20 @@ export class KpiUserRoleController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้");
} }
const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({ const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({
where:{id:requestBody.kpiUserEvaluationId}, where: { id: requestBody.kpiUserEvaluationId },
}) });
if (!chkUserEvaluation) { if (!chkUserEvaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน");
} }
const chkKpiRole = await this.kpiRoleRepository.findOne({ const chkKpiRole = await this.kpiRoleRepository.findOne({
where:{id:requestBody.kpiRoleId}, where: { id: requestBody.kpiRoleId },
}) });
if (!chkKpiRole) { if (!chkKpiRole) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินตามหน้าที่ความรับผิดชอบหลัก"); throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลแบบประเมินตามหน้าที่ความรับผิดชอบหลัก",
);
} }
kpiUserRole.lastUpdateUserId = request.user.sub; kpiUserRole.lastUpdateUserId = request.user.sub;
@ -142,14 +153,14 @@ export class KpiUserRoleController extends Controller {
@Get("{id}") @Get("{id}")
async GetKpiUserRoleDetail(@Path() id: string) { async GetKpiUserRoleDetail(@Path() id: string) {
const getKpiUserRole = await this.kpiUserRoleRepository.findOne({ const getKpiUserRole = await this.kpiUserRoleRepository.findOne({
relations: ["kpiRole","kpiUserEvaluation"], relations: ["kpiRole", "kpiUserEvaluation"],
where: { id: id }, where: { id: id },
}); });
if (!getKpiUserRole) { if (!getKpiUserRole) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้");
} }
const mapKpiUserRole = ({ const mapKpiUserRole = {
id: getKpiUserRole.id, id: getKpiUserRole.id,
evaluationId: getKpiUserRole.kpiUserEvaluation.id, evaluationId: getKpiUserRole.kpiUserEvaluation.id,
kpiRoleId: getKpiUserRole.kpiRole.id, kpiRoleId: getKpiUserRole.kpiRole.id,
@ -160,7 +171,7 @@ export class KpiUserRoleController extends Controller {
unit: getKpiUserRole.unit, unit: getKpiUserRole.unit,
meaning: getKpiUserRole.meaning, meaning: getKpiUserRole.meaning,
formula: getKpiUserRole.formula, formula: getKpiUserRole.formula,
}); };
return new HttpSuccess(mapKpiUserRole); return new HttpSuccess(mapKpiUserRole);
} }
@ -172,14 +183,12 @@ export class KpiUserRoleController extends Controller {
* *
*/ */
@Get() @Get()
async GetKpiUserRole( async GetKpiUserRole(@Query("id") id: string) {
@Query("id") id: string ,
) {
const kpiUserRole = await this.kpiUserRoleRepository.find({ const kpiUserRole = await this.kpiUserRoleRepository.find({
where:{ where: {
kpiUserEvaluationId:id kpiUserEvaluationId: id,
}, },
relations: ["kpiRole","kpiUserEvaluation"], relations: ["kpiRole", "kpiUserEvaluation"],
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
}); });
@ -195,11 +204,18 @@ export class KpiUserRoleController extends Controller {
meaning: item.meaning, meaning: item.meaning,
formula: item.formula, formula: item.formula,
point: item.point, point: item.point,
achievement: item.point === 1 ? "ระดับ 1" : achievement:
item.point === 2 ? "ระดับ 2" : item.point === 1
item.point === 3 ? "ระดับ 3" : ? item.kpiRole.achievement1
item.point === 4 ? "ระดับ 4" : : item.point === 2
item.point === 5 ? "ระดับ 5" : null, ? item.kpiRole.achievement2
: item.point === 3
? item.kpiRole.achievement3
: item.point === 4
? item.kpiRole.achievement4
: item.point === 5
? item.kpiRole.achievement5
: null,
achievement1: item.kpiRole.achievement1, achievement1: item.kpiRole.achievement1,
achievement2: item.kpiRole.achievement2, achievement2: item.kpiRole.achievement2,
achievement3: item.kpiRole.achievement3, achievement3: item.kpiRole.achievement3,
@ -209,31 +225,33 @@ export class KpiUserRoleController extends Controller {
return new HttpSuccess(mapKpiUserRole); return new HttpSuccess(mapKpiUserRole);
} }
/** /**
* API * API
* *
* @summary * @summary
* *
* *
*/ */
@Post("point") @Post("point")
async CreateKpiUserRolePoint( async CreateKpiUserRolePoint(
@Body() requestBody: KpiUserRoleDataPoint[], @Body() requestBody: KpiUserRoleDataPoint[],
@Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
){ ) {
for (const item of requestBody) {
for (const item of requestBody) { const kpiUserRole = await this.kpiUserRoleRepository.findOne({
const kpiUserRole = await this.kpiUserRoleRepository.findOne({ where: { id: item.id },
where: { id: item.id }, });
}); if (!kpiUserRole) {
if (!kpiUserRole) { throw new HttpError(
throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้: ${item.id}`); HttpStatusCode.NOT_FOUND,
} `ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้: ${item.id}`,
this.kpiUserRoleRepository.merge(kpiUserRole, item); );
kpiUserRole.lastUpdateUserId = request.user.sub; }
kpiUserRole.lastUpdateFullName = request.user.name; this.kpiUserRoleRepository.merge(kpiUserRole, item);
await this.kpiUserRoleRepository.save(kpiUserRole); kpiUserRole.lastUpdateUserId = request.user.sub;
} kpiUserRole.lastUpdateFullName = request.user.name;
return new HttpSuccess(); await this.kpiUserRoleRepository.save(kpiUserRole);
} }
return new HttpSuccess();
}
} }

View file

@ -0,0 +1,229 @@
import {
Controller,
Get,
Post,
Put,
Delete,
Route,
Security,
Tags,
Body,
Path,
Request,
SuccessResponse,
Response,
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import {
KpiUserSpecial,
CreateKpiUserSpecial,
UpdateKpiUserSpecial,
KpiUserSpecialDataPoint,
} from "../entities/kpiUserSpecial";
import HttpError from "../interfaces/http-error";
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
@Route("api/v1/kpi/user/achievement/special")
@Tags("KpiUserSpecial")
@Security("bearerAuth")
@Response(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class KpiUserSpecialController extends Controller {
private kpiUserSpecialRepository = AppDataSource.getRepository(KpiUserSpecial);
private kpiUserEvaluationRepository = AppDataSource.getRepository(KpiUserEvaluation);
/**
* API
*
* @summary - #
*
*/
@Post()
async createKpiUserSpecial(
@Body()
requestBody: CreateKpiUserSpecial,
@Request() request: { user: Record<string, any> },
) {
const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({
where: { id: requestBody.kpiUserEvaluationId },
});
if (!chkUserEvaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน");
}
const kpiUserSpecial = Object.assign(new KpiUserSpecial(), requestBody);
if (!kpiUserSpecial) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
kpiUserSpecial.createdUserId = request.user.sub;
kpiUserSpecial.createdFullName = request.user.name;
kpiUserSpecial.lastUpdateUserId = request.user.sub;
kpiUserSpecial.lastUpdateFullName = request.user.name;
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
return new HttpSuccess(kpiUserSpecial.id);
}
/**
* API
*
* @summary - #
*
* @param {string} id Id
*/
@Put("{id}")
async editKpiUserSpecial(
@Path() id: string,
@Body() requestBody: UpdateKpiUserSpecial,
@Request() request: { user: Record<string, any> },
) {
const kpiUserSpecial = await this.kpiUserSpecialRepository.findOne({ where: { id } });
if (!kpiUserSpecial) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานที่ได้รับมอบหมายพิเศษนี้");
}
const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({
where: { id: requestBody.kpiUserEvaluationId },
});
if (!chkUserEvaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน");
}
kpiUserSpecial.lastUpdateUserId = request.user.sub;
kpiUserSpecial.lastUpdateFullName = request.user.name;
Object.assign(kpiUserSpecial, requestBody);
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
return new HttpSuccess(kpiUserSpecial.id);
}
/**
* API
*
* @summary - #
*
*/
@Delete("{id}")
async deleteKpiUserSpecial(@Path() id: string) {
const delKpiUserSpecial = await this.kpiUserSpecialRepository.findOne({ where: { id } });
if (!delKpiUserSpecial) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานที่ได้รับมอบหมายพิเศษนี้");
}
await this.kpiUserSpecialRepository.remove(delKpiUserSpecial);
return new HttpSuccess();
}
/**
* API
*
* @summary - #
*
* @param {string} id Id
*/
@Get("{id}")
async GetKpiUserSpecialDetail(@Path() id: string) {
const getKpiUserSpecial = await this.kpiUserSpecialRepository.findOne({
relations: ["kpiUserEvaluation"],
where: { id: id },
});
if (!getKpiUserSpecial) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานที่ได้รับมอบหมายพิเศษนี้");
}
const mapKpiUserSpecial = {
id: getKpiUserSpecial.id,
evaluationId: getKpiUserSpecial.kpiUserEvaluation.id,
including: getKpiUserSpecial.including,
includingName: getKpiUserSpecial.includingName,
target: getKpiUserSpecial.target,
weight: getKpiUserSpecial.weight,
unit: getKpiUserSpecial.unit,
meaning: getKpiUserSpecial.meaning,
formula: getKpiUserSpecial.formula,
};
return new HttpSuccess(mapKpiUserSpecial);
}
/**
* API
*
* @summary - #
*
*/
@Get()
async GetKpiUserSpecial(@Query("id") id: string) {
const kpiUserSpecial = await this.kpiUserSpecialRepository.find({
where: {
kpiUserEvaluationId: id,
},
relations: ["kpiUserEvaluation"],
order: { createdAt: "ASC" },
});
const mapKpiUserSpecial = kpiUserSpecial.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(mapKpiUserSpecial);
}
/**
* API
*
* @summary
*
*
*/
@Post("point")
async CreateKpiUserSpecialPoint(
@Body() requestBody: KpiUserSpecialDataPoint[],
@Request() request: { user: Record<string, any> },
) {
for (const item of requestBody) {
const kpiUserSpecial = await this.kpiUserSpecialRepository.findOne({
where: { id: item.id },
});
if (!kpiUserSpecial) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
`ไม่พบข้อมูลงานที่ได้รับมอบหมายพิเศษนี้: ${item.id}`,
);
}
this.kpiUserSpecialRepository.merge(kpiUserSpecial, item);
kpiUserSpecial.lastUpdateUserId = request.user.sub;
kpiUserSpecial.lastUpdateFullName = request.user.name;
await this.kpiUserSpecialRepository.save(kpiUserSpecial);
}
return new HttpSuccess();
}
}

View file

@ -122,3 +122,66 @@ export class KpiUserSpecial extends EntityBase {
@JoinColumn({ name: "kpiUserEvaluationId" }) @JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluation: KpiUserEvaluation; kpiUserEvaluation: KpiUserEvaluation;
} }
export class CreateKpiUserSpecial {
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
target: string;
@Column()
unit: number;
@Column()
weight: number;
@Column()
meaning: string;
@Column()
formula: string;
@Column("uuid")
kpiUserEvaluationId: string;
}
export class UpdateKpiUserSpecial {
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
target: string;
@Column()
unit: number;
@Column()
weight: number;
@Column()
meaning: string;
@Column()
formula: string;
@Column("uuid")
kpiUserEvaluationId: string;
}
export class KpiUserSpecialDataPoint {
id: string;
point: number;
}