เพิ่มฟิวผู้บังคับ
This commit is contained in:
parent
ba00645cb8
commit
ecbb9c0d9f
7 changed files with 171 additions and 64 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue