fix เพิ่มตัวชี้วัด
This commit is contained in:
parent
fb41b66bf9
commit
555e56417b
2 changed files with 6 additions and 4 deletions
|
|
@ -48,14 +48,15 @@ export class kpiPlanController extends Controller {
|
|||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiPlan = Object.assign(new KpiPlan(), requestBody);
|
||||
if (requestBody.year != null) {
|
||||
if (requestBody.year != null && requestBody.period != null) {
|
||||
const kpiPeriod = await this.kpiPeriodRepository
|
||||
.createQueryBuilder("kpiPeriod")
|
||||
.where("kpiPeriod.year = :year", { year: requestBody.year })
|
||||
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
|
||||
.getOne();
|
||||
if (!kpiPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบการประเมินนี้ในปีงบประมาณ "+requestBody.year);
|
||||
}
|
||||
}
|
||||
await new CallAPI()
|
||||
|
|
|
|||
|
|
@ -48,14 +48,15 @@ export class kpiRoleController extends Controller {
|
|||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiRole = Object.assign(new KpiRole(), requestBody);
|
||||
if (requestBody.year != null) {
|
||||
if (requestBody.year != null && requestBody.period != null) {
|
||||
const kpiPeriod = await this.kpiPeriodRepository
|
||||
.createQueryBuilder("kpiPeriod")
|
||||
.where("kpiPeriod.year = :year", { year: requestBody.year })
|
||||
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
|
||||
.getOne();
|
||||
if (!kpiPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบการประเมินนี้ในปีงบประมาณ "+requestBody.year);
|
||||
}
|
||||
}
|
||||
await new CallAPI()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue