เพิ่ม put เเก้ไข status/edit
This commit is contained in:
parent
fe7dcd6815
commit
940a6171ca
2 changed files with 72 additions and 0 deletions
|
|
@ -27,6 +27,8 @@ import {
|
|||
updateKpiUserCheckEvaluation,
|
||||
updateKpiUserEvaluation,
|
||||
updateKpiUserPointEvaluation,
|
||||
updateKpiUserStatusEvaluation,
|
||||
updateKpiUserReqEditEvaluation,
|
||||
} from "../entities/kpiUserEvaluation";
|
||||
import { Like, In, Brackets } from "typeorm";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
|
|
@ -230,6 +232,66 @@ export class KpiUserEvaluationController extends Controller {
|
|||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขสถานะประเมิน (USER)
|
||||
*
|
||||
* @summary แก้ไขคนประเมิน (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Put("edit/{id}")
|
||||
async updateKpiUserReqEditEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserReqEditEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
kpiUserEvaluation.evaluationReqEdit = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
// Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขสถานะประเมิน (USER)
|
||||
*
|
||||
* @summary แก้ไขคนประเมิน (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Put("status/{id}")
|
||||
async updateKpiUserStatusEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserStatusEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
kpiUserEvaluation.evaluationStatus = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
// Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -203,3 +203,13 @@ export class updateKpiUserPointEvaluation {
|
|||
@Column()
|
||||
capacityPoint: number | null;
|
||||
}
|
||||
|
||||
export class updateKpiUserReqEditEvaluation {
|
||||
@Column()
|
||||
status: string;
|
||||
}
|
||||
|
||||
export class updateKpiUserStatusEvaluation {
|
||||
@Column()
|
||||
status: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue