point
This commit is contained in:
parent
133fc76f66
commit
bdd2c9aa30
2 changed files with 37 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatusCode from "../interfaces/http-status";
|
import HttpStatusCode from "../interfaces/http-status";
|
||||||
import { KpiCapacity } from "../entities/kpiCapacity";
|
import { KpiCapacity } from "../entities/kpiCapacity";
|
||||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||||
import { KpiUserCapacity, } from "../entities/kpiUserCapacity";
|
import { KpiUserCapacity, KpiUserCapacityDataPoint} from "../entities/kpiUserCapacity";
|
||||||
import { Like, In } from "typeorm";
|
import { Like, In } from "typeorm";
|
||||||
import { Double } from "typeorm/browser";
|
import { Double } from "typeorm/browser";
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ export class KpiUserCapacityController extends Controller {
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
kpiCapacityId: string;
|
kpiCapacityId: string;
|
||||||
level: string;
|
level: string;
|
||||||
point: number;
|
// point: number;
|
||||||
weight: number;
|
weight: number;
|
||||||
summary: Double
|
summary: Double
|
||||||
},
|
},
|
||||||
|
|
@ -100,7 +100,7 @@ export class KpiUserCapacityController extends Controller {
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
kpiCapacityId: string;
|
kpiCapacityId: string;
|
||||||
level: string;
|
level: string;
|
||||||
point: number;
|
// point: number;
|
||||||
weight: number;
|
weight: number;
|
||||||
summary: Double
|
summary: Double
|
||||||
},
|
},
|
||||||
|
|
@ -220,10 +220,38 @@ export class KpiUserCapacityController extends Controller {
|
||||||
if (!kpiUserCapacity) {
|
if (!kpiUserCapacity) {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatusCode.NOT_FOUND,
|
HttpStatusCode.NOT_FOUND,
|
||||||
"ไม่พบข้อมูลการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
"ไม่พบข้อมูลองค์ประกอบที่ 2 พฤติกรรมการปฎิบัติราชการ (สมรรถนะ)นี้",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await this.kpiUserCapacityRepository.remove(kpiUserCapacity);
|
await this.kpiUserCapacityRepository.remove(kpiUserCapacity);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API กรอกระดับคะแนนตามเกณฑ์การประเมิน (สมรรถนะ) (USER)
|
||||||
|
*
|
||||||
|
* @summary กรอกระดับคะแนนตามเกณฑ์การประเมิน (สมรรถนะ) (USER)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("point")
|
||||||
|
async CreateKpiUserCapacityPoint(
|
||||||
|
@Body() requestBody: KpiUserCapacityDataPoint[],
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
){
|
||||||
|
|
||||||
|
for (const item of requestBody) {
|
||||||
|
const kpiUserCapacity = await this.kpiUserCapacityRepository.findOne({
|
||||||
|
where: { id: item.id },
|
||||||
|
});
|
||||||
|
if (!kpiUserCapacity) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลพฤติกรรมการปฎิบัติราชการ (สมรรถนะ): ${item.id}`);
|
||||||
|
}
|
||||||
|
this.kpiUserCapacityRepository.merge(kpiUserCapacity, item);
|
||||||
|
kpiUserCapacity.lastUpdateUserId = request.user.sub;
|
||||||
|
kpiUserCapacity.lastUpdateFullName = request.user.name;
|
||||||
|
await this.kpiUserCapacityRepository.save(kpiUserCapacity);
|
||||||
|
}
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,3 +58,8 @@ export class KpiUserCapacity extends EntityBase {
|
||||||
@JoinColumn({ name: "kpiCapacityId" })
|
@JoinColumn({ name: "kpiCapacityId" })
|
||||||
kpiCapacity: KpiCapacity;
|
kpiCapacity: KpiCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class KpiUserCapacityDataPoint {
|
||||||
|
id: string;
|
||||||
|
point: number;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue