เพิ่มฟิวผู้บังคับ

This commit is contained in:
Kittapath 2024-04-26 13:08:23 +07:00
parent ba00645cb8
commit ecbb9c0d9f
7 changed files with 171 additions and 64 deletions

View file

@ -76,15 +76,18 @@ export class KpiUserRoleController extends Controller {
if (!kpiUserRole) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const chk_indicator = await this.kpiUserRoleRepository.findOne({
where: {
kpiUserEvaluationId: requestBody.kpiUserEvaluationId,
kpiRoleId: requestBody.kpiRoleId,
},
})
});
if (chk_indicator) {
throw new HttpError(HttpStatusCode.CONFLICT, "ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ");
throw new HttpError(
HttpStatusCode.CONFLICT,
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
);
}
kpiUserRole.createdUserId = request.user.sub;
@ -128,16 +131,19 @@ export class KpiUserRoleController extends Controller {
"ไม่พบข้อมูลแบบประเมินตามหน้าที่ความรับผิดชอบหลัก",
);
}
const chk_indicator = await this.kpiUserRoleRepository.findOne({
where: {
id: Not(id),
kpiUserEvaluationId: requestBody.kpiUserEvaluationId,
kpiRoleId: requestBody.kpiRoleId,
},
})
});
if (chk_indicator) {
throw new HttpError(HttpStatusCode.CONFLICT, "ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ");
throw new HttpError(
HttpStatusCode.CONFLICT,
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากข้อมูลตัวชี้วัดซ้ำ",
);
}
kpiUserRole.lastUpdateUserId = request.user.sub;