ผูกสิดข้อมูลหลัก
This commit is contained in:
parent
f9fce4ba25
commit
92b2291c4b
15 changed files with 702 additions and 514 deletions
|
|
@ -10,10 +10,8 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
|
|
@ -22,7 +20,7 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import { KpiPlan, createKpiPlan, updateKpiPlan } from "../entities/kpiPlan";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import { KpiPeriod } from "../entities/kpiPeriod";
|
||||
import { Brackets, IsNull, Not } from "typeorm";
|
||||
import { Brackets, IsNull } from "typeorm";
|
||||
import { KpiPlanHistory } from "../entities/kpiPlanHistory";
|
||||
import { KpiSpecial } from "../entities/kpiSpecial";
|
||||
import { KpiRole } from "../entities/kpiRole";
|
||||
|
|
@ -48,11 +46,8 @@ export class kpiPlanController extends Controller {
|
|||
* @param request
|
||||
*/
|
||||
@Post()
|
||||
async createKpiPlan(
|
||||
@Body() requestBody: createKpiPlan,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request,"SYS_EVA_INDICATOR");
|
||||
async createKpiPlan(@Body() requestBody: createKpiPlan, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionCreate(request, "SYS_EVA_INDICATOR");
|
||||
const kpiPlan = Object.assign(new KpiPlan(), requestBody);
|
||||
if (requestBody.year != null && requestBody.period != null) {
|
||||
const kpiPeriod = await this.kpiPeriodRepository
|
||||
|
|
@ -212,7 +207,7 @@ export class kpiPlanController extends Controller {
|
|||
@Body() requestBody: updateKpiPlan,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request,"SYS_EVA_INDICATOR");
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_INDICATOR");
|
||||
const kpiPlan = await this.kpiPlanRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -294,7 +289,8 @@ export class kpiPlanController extends Controller {
|
|||
* @param id Guid, *Id ตัวชี้วัดตามแผนฯ
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetKpiPlanById(@Path() id: string) {
|
||||
async GetKpiPlanById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
const kpiPlan = await this.kpiPlanRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: { kpiPeriod: true },
|
||||
|
|
@ -398,6 +394,7 @@ export class kpiPlanController extends Controller {
|
|||
*/
|
||||
@Post("search")
|
||||
async listKpiPlan(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
|
|
@ -411,6 +408,7 @@ export class kpiPlanController extends Controller {
|
|||
// isNull?: boolean | false;
|
||||
},
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
let condition = "";
|
||||
let parameters: any = {};
|
||||
if (requestBody.isAll === false) {
|
||||
|
|
@ -506,7 +504,7 @@ export class kpiPlanController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiPlan(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request,"SYS_EVA_INDICATOR");
|
||||
await new permission().PermissionDelete(request, "SYS_EVA_INDICATOR");
|
||||
const kpiPlan = await this.kpiPlanRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -592,7 +590,8 @@ export class kpiPlanController extends Controller {
|
|||
* @param id Guid, *Id ประวัดิตัวชี้วัดตามแผน
|
||||
*/
|
||||
@Get("history/{id}")
|
||||
async GetHistory(@Path() id: string) {
|
||||
async GetHistory(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
const kpiPlanHistory = await this.kpiPlanHistoryRepository.find({
|
||||
where: { kpiPlanId: id },
|
||||
order: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue