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> },
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
const kpiPlan = Object.assign(new KpiPlan(), requestBody);
|
const kpiPlan = Object.assign(new KpiPlan(), requestBody);
|
||||||
if (requestBody.year != null) {
|
if (requestBody.year != null && requestBody.period != null) {
|
||||||
const kpiPeriod = await this.kpiPeriodRepository
|
const kpiPeriod = await this.kpiPeriodRepository
|
||||||
.createQueryBuilder("kpiPeriod")
|
.createQueryBuilder("kpiPeriod")
|
||||||
.where("kpiPeriod.year = :year", { year: requestBody.year })
|
.where("kpiPeriod.year = :year", { year: requestBody.year })
|
||||||
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
|
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
|
||||||
.getOne();
|
.getOne();
|
||||||
if (!kpiPeriod) {
|
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()
|
await new CallAPI()
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,15 @@ export class kpiRoleController extends Controller {
|
||||||
@Request() request: { user: Record<string, any> },
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
const kpiRole = Object.assign(new KpiRole(), requestBody);
|
const kpiRole = Object.assign(new KpiRole(), requestBody);
|
||||||
if (requestBody.year != null) {
|
if (requestBody.year != null && requestBody.period != null) {
|
||||||
const kpiPeriod = await this.kpiPeriodRepository
|
const kpiPeriod = await this.kpiPeriodRepository
|
||||||
.createQueryBuilder("kpiPeriod")
|
.createQueryBuilder("kpiPeriod")
|
||||||
.where("kpiPeriod.year = :year", { year: requestBody.year })
|
.where("kpiPeriod.year = :year", { year: requestBody.year })
|
||||||
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
|
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
|
||||||
.getOne();
|
.getOne();
|
||||||
if (!kpiPeriod) {
|
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()
|
await new CallAPI()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue