Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 56s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 56s
This commit is contained in:
commit
1e5aa2da3c
1 changed files with 37 additions and 11 deletions
|
|
@ -40,6 +40,11 @@ import permission from "../interfaces/permission";
|
|||
import { resolveNodeId, resolveNodeLevel, setLogDataDiff } from "../interfaces/utils";
|
||||
import { KpiUserRejectAgreement } from "../entities/kpiUserRejectAgreement";
|
||||
import { KpiUserRejectResult } from "../entities/kpiUserRejectResult";
|
||||
import { KpiUserCapacity } from "../entities/kpiUserCapacity";
|
||||
import { KpiUserPlanned } from "../entities/kpiUserPlanned"
|
||||
import { KpiUserRole } from "../entities/kpiUserRole";
|
||||
import { KpiUserSpecial } from "../entities/kpiUserSpecial";
|
||||
import { KpiUserDevelopment } from "../entities/kpiUserDevelopment";
|
||||
|
||||
@Route("api/v1/kpi/user/evaluation")
|
||||
@Tags("kpiUserEvaluation")
|
||||
|
|
@ -1875,18 +1880,39 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @param {string} id Guid, *Id รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiUserEvaluation(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
async deleteKpiUserEvaluation(@Path() id: string, @Request() request: RequestWithUser
|
||||
) {
|
||||
const queryRunner = AppDataSource.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
|
||||
try {
|
||||
const kpiUserEvaluation = await queryRunner.manager.findOne(KpiUserEvaluation, {
|
||||
where: { id },
|
||||
});
|
||||
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลการประเมินผลการปฏิบัติราชการระดับบุคคลนี้"
|
||||
);
|
||||
}
|
||||
await queryRunner.manager.delete(KpiUserCapacity, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserPlanned, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserRole, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserSpecial, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserDevelopment, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserRejectAgreement, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserRejectResult, { kpiUserEvaluationId: id });
|
||||
await queryRunner.manager.delete(KpiUserEvaluation, { id });
|
||||
await queryRunner.commitTransaction();
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
await this.kpiUserEvalutionRepository.remove(kpiUserEvaluation, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue