เพิ่มเส้น point

This commit is contained in:
AdisakKanthawilang 2024-05-09 11:41:26 +07:00
parent 98a28db920
commit 5f94e63503

View file

@ -234,30 +234,30 @@ export class KpiUserDevelopmentController extends Controller {
return new HttpSuccess(mapKpiUserDevelopment);
}
// /**
// * API กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี
// *
// * @summary กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี
// *
// *
// */
// @Post("point")
// async CreateKpiUserDevelopmentPoint(
// @Body() requestBody: KpiUserDevelopmentDataPoint[],
// @Request() request: { user: Record<string, any> },
// ) {
// for (const item of requestBody) {
// const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
// where: { id: item.id },
// });
// if (!kpiUserDevelopment) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลพัฒนาตนเองนี้: ${item.id}`);
// }
// this.kpiUserDevelopmentRepository.merge(kpiUserDevelopment, item);
// kpiUserDevelopment.lastUpdateUserId = request.user.sub;
// kpiUserDevelopment.lastUpdateFullName = request.user.name;
// await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment);
// }
// return new HttpSuccess();
// }
/**
* API
*
* @summary
*
*
*/
@Post("point")
async CreateKpiUserDevelopmentPoint(
@Body() requestBody: KpiUserDevelopmentDataPoint[],
@Request() request: { user: Record<string, any> },
) {
for (const item of requestBody) {
const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
where: { id: item.id },
});
if (!kpiUserDevelopment) {
throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลพัฒนาตนเองนี้: ${item.id}`);
}
this.kpiUserDevelopmentRepository.merge(kpiUserDevelopment, item);
kpiUserDevelopment.lastUpdateUserId = request.user.sub;
kpiUserDevelopment.lastUpdateFullName = request.user.name;
await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment);
}
return new HttpSuccess();
}
}