summary
This commit is contained in:
parent
56f4d0d4f5
commit
369803113e
1 changed files with 20 additions and 0 deletions
|
|
@ -24,6 +24,8 @@ import CallAPI from "../interfaces/call-api";
|
||||||
import { KpiPeriod } from "../entities/kpiPeriod";
|
import { KpiPeriod } from "../entities/kpiPeriod";
|
||||||
import { Brackets, IsNull, Not } from "typeorm";
|
import { Brackets, IsNull, Not } from "typeorm";
|
||||||
import { KpiPlanHistory } from "../entities/kpiPlanHistory";
|
import { KpiPlanHistory } from "../entities/kpiPlanHistory";
|
||||||
|
import { KpiSpecial } from "../entities/kpiSpecial";
|
||||||
|
import { KpiRole } from "../entities/kpiRole";
|
||||||
|
|
||||||
@Route("api/v1/kpi/plan")
|
@Route("api/v1/kpi/plan")
|
||||||
@Tags("kpiPlan")
|
@Tags("kpiPlan")
|
||||||
|
|
@ -35,6 +37,8 @@ import { KpiPlanHistory } from "../entities/kpiPlanHistory";
|
||||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||||
export class kpiPlanController extends Controller {
|
export class kpiPlanController extends Controller {
|
||||||
private kpiPlanRepository = AppDataSource.getRepository(KpiPlan);
|
private kpiPlanRepository = AppDataSource.getRepository(KpiPlan);
|
||||||
|
private kpiRoleRepository = AppDataSource.getRepository(KpiRole);
|
||||||
|
private kpiSpecialRepository = AppDataSource.getRepository(KpiSpecial);
|
||||||
private kpiPlanHistoryRepository = AppDataSource.getRepository(KpiPlanHistory);
|
private kpiPlanHistoryRepository = AppDataSource.getRepository(KpiPlanHistory);
|
||||||
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
||||||
/**
|
/**
|
||||||
|
|
@ -596,4 +600,20 @@ export class kpiPlanController extends Controller {
|
||||||
}
|
}
|
||||||
return new HttpSuccess(kpiPlanHistory);
|
return new HttpSuccess(kpiPlanHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API summary ของตัวชี้วัดในระบบ
|
||||||
|
*/
|
||||||
|
@Post("summary/indicator")
|
||||||
|
async GetSummary(@Path() id: string) {
|
||||||
|
const kpiPlan = await this.kpiPlanRepository.count();
|
||||||
|
const kpiRole = await this.kpiRoleRepository.count();
|
||||||
|
const kpiSpecial = await this.kpiSpecialRepository.count();
|
||||||
|
return new HttpSuccess({
|
||||||
|
kpiPlan,
|
||||||
|
kpiRole,
|
||||||
|
kpiSpecial,
|
||||||
|
total: kpiPlan + kpiRole + kpiSpecial,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue