ผูกสิดข้อมูลหลัก
This commit is contained in:
parent
f9fce4ba25
commit
92b2291c4b
15 changed files with 702 additions and 514 deletions
|
|
@ -69,7 +69,7 @@ export class kpiCapacityController extends Controller {
|
|||
},
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request,"SYS_EVA_COMPETENCY");
|
||||
await new permission().PermissionCreate(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiCapacity = Object.assign(new KpiCapacity(), {
|
||||
type: requestBody.type,
|
||||
name: requestBody.name,
|
||||
|
|
@ -134,7 +134,7 @@ export class kpiCapacityController extends Controller {
|
|||
},
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request,"SYS_EVA_COMPETENCY");
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiCapacity = await this.kpiCapacityRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -285,7 +285,8 @@ export class kpiCapacityController extends Controller {
|
|||
},
|
||||
],
|
||||
})
|
||||
async GetKpiCapacityById(@Path() id: string) {
|
||||
async GetKpiCapacityById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiCapacity = await this.kpiCapacityRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["type", "name", "description"],
|
||||
|
|
@ -315,11 +316,13 @@ export class kpiCapacityController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async listKpiCapacity(
|
||||
@Request() request: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("type") type?: string,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
const [kpiCapacity, total] = await AppDataSource.getRepository(KpiCapacity)
|
||||
.createQueryBuilder("kpiCapacity")
|
||||
.leftJoinAndSelect("kpiCapacity.kpiCapacityDetails", "kpiCapacityDetail")
|
||||
|
|
@ -360,7 +363,7 @@ export class kpiCapacityController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiCapacity(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request,"SYS_EVA_COMPETENCY");
|
||||
await new permission().PermissionDelete(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiCapacity = await this.kpiCapacityRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
|
|
@ -18,7 +14,7 @@ import {
|
|||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { Like, Not } from "typeorm";
|
||||
import { Like } from "typeorm";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { KpiEvaluation, updateKpiEvaluation } from "../entities/kpiEvaluation";
|
||||
import permission from "../interfaces/permission";
|
||||
|
|
@ -43,7 +39,7 @@ export class kpiEvaluationController extends Controller {
|
|||
@Body() requestBody: updateKpiEvaluation[],
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request,"SYS_EVA_COMPETENCY");
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_COMPETENCY");
|
||||
const updatedIds: string[] = [];
|
||||
|
||||
for (const item of requestBody) {
|
||||
|
|
@ -70,10 +66,12 @@ export class kpiEvaluationController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async listKpiEvaluation(
|
||||
@Request() request: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
let whereClause: any = {};
|
||||
|
||||
if (keyword !== undefined && keyword !== "") {
|
||||
|
|
|
|||
|
|
@ -43,11 +43,8 @@ export class kpiGroupController extends Controller {
|
|||
@Example({
|
||||
nameGroupKPI: "string", //ชื่อกลุ่มงาน
|
||||
})
|
||||
async createKpiGroup(
|
||||
@Body() requestBody: createKpiGroup,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request,"SYS_EVA_COMPETENCY");
|
||||
async createKpiGroup(@Body() requestBody: createKpiGroup, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionCreate(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiGroup = Object.assign(new KpiGroup(), requestBody);
|
||||
const chkkpinameGroup = await this.kpiGroupRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -75,7 +72,7 @@ export class kpiGroupController extends Controller {
|
|||
@Body() requestBody: updateKpiGroup,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request,"SYS_EVA_COMPETENCY");
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiGroup = await this.kpiGroupRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -86,7 +83,7 @@ export class kpiGroupController extends Controller {
|
|||
const chkkpinameGroup = await this.kpiGroupRepository.findOne({
|
||||
where: {
|
||||
nameGroupKPI: requestBody.nameGroupKPI,
|
||||
id: Not(id)
|
||||
id: Not(id),
|
||||
},
|
||||
});
|
||||
if (chkkpinameGroup) {
|
||||
|
|
@ -107,7 +104,8 @@ export class kpiGroupController extends Controller {
|
|||
@Example({
|
||||
nameGroupKPI: "string", //ชื่อกลุ่มงาน
|
||||
})
|
||||
async KpiGroupById(@Path() id: string) {
|
||||
async KpiGroupById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiGroup = await this.kpiGroupRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["nameGroupKPI"],
|
||||
|
|
@ -124,7 +122,7 @@ export class kpiGroupController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiGroup(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request,"SYS_EVA_COMPETENCY");
|
||||
await new permission().PermissionDelete(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiGroup = await this.kpiGroupRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -143,10 +141,12 @@ export class kpiGroupController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async listKpiGroup(
|
||||
@Request() request: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
let whereClause: any = {};
|
||||
|
||||
if (keyword !== undefined && keyword !== "") {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
|
|
@ -18,9 +17,9 @@ import {
|
|||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { Like, Not, In, Brackets } from "typeorm";
|
||||
import { In, Brackets } from "typeorm";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { KpiLink, createKpiLink, updateKpiLink } from "../entities/kpiLink";
|
||||
import { KpiLink, createKpiLink } from "../entities/kpiLink";
|
||||
import { KpiGroup } from "../entities/kpiGroup";
|
||||
import { KpiCapacity } from "../entities/kpiCapacity";
|
||||
import { Position } from "../entities/position";
|
||||
|
|
@ -165,7 +164,8 @@ export class kpiLinkController extends Controller {
|
|||
* @param id
|
||||
*/
|
||||
@Get("{id}")
|
||||
async KpiLinkById(@Path() id: string) {
|
||||
async KpiLinkById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
const kpiLink = await this.kpiLinkRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["positions", "kpiCapacitys", "kpiGroup"],
|
||||
|
|
@ -224,10 +224,12 @@ export class kpiLinkController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async listKpiLink(
|
||||
@Request() request: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_COMPETENCY");
|
||||
const [_kpiLink, _total] = await AppDataSource.getRepository(KpiLink)
|
||||
.createQueryBuilder("kpiLink")
|
||||
.leftJoinAndSelect("kpiLink.kpiGroup", "kpiGroup")
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import {
|
|||
updateKpiUserReasonEvaluation,
|
||||
} from "../entities/kpiUserEvaluationReasonCapacity";
|
||||
import { KpiUserEvaluationReasonDevelopment } from "../entities/kpiUserEvaluationReasonDevelopment";
|
||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import { KpiUserRole } from "../entities/kpiUserRole";
|
||||
import { KpiUserSpecial } from "../entities/kpiUserSpecial";
|
||||
import { KpiUserCapacity } from "../entities/kpiUserCapacity";
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -44,11 +42,8 @@ export class kpiRoleController extends Controller {
|
|||
* @param request
|
||||
*/
|
||||
@Post()
|
||||
async createKpiRole(
|
||||
@Body() requestBody: createKpiRole,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request,"SYS_EVA_INDICATOR");
|
||||
async createKpiRole(@Body() requestBody: createKpiRole, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionCreate(request, "SYS_EVA_INDICATOR");
|
||||
const kpiRole = Object.assign(new KpiRole(), requestBody);
|
||||
if (requestBody.year != null && requestBody.period != null) {
|
||||
const kpiPeriod = await this.kpiPeriodRepository
|
||||
|
|
@ -205,7 +200,7 @@ export class kpiRoleController extends Controller {
|
|||
@Body() requestBody: updateKpiRole,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request,"SYS_EVA_INDICATOR");
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_INDICATOR");
|
||||
const kpiRole = await this.kpiRoleRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -269,7 +264,8 @@ export class kpiRoleController extends Controller {
|
|||
* @param id Guid, *Id ตัวชี้วัดตามตำแหน่ง
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetKpiRoleById(@Path() id: string) {
|
||||
async GetKpiRoleById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
const kpiRole = await this.kpiRoleRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: { kpiPeriod: true },
|
||||
|
|
@ -343,6 +339,7 @@ export class kpiRoleController extends Controller {
|
|||
*/
|
||||
@Post("search")
|
||||
async listKpiRole(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
|
|
@ -357,6 +354,7 @@ export class kpiRoleController extends Controller {
|
|||
// isNull?: boolean | false;
|
||||
},
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
let condition = "";
|
||||
let parameters: any = {};
|
||||
if (requestBody.isAll === false) {
|
||||
|
|
@ -468,8 +466,8 @@ export class kpiRoleController extends Controller {
|
|||
* @param id
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiRole(@Path() id: string,@Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request,"SYS_EVA_INDICATOR");
|
||||
async deleteKpiRole(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_EVA_INDICATOR");
|
||||
const kpiRole = await this.kpiRoleRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -559,7 +557,8 @@ export class kpiRoleController 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 kpiRoleHistory = await this.kpiRoleHistoryRepository.find({
|
||||
where: { kpiRoleId: id },
|
||||
order: {
|
||||
|
|
|
|||
|
|
@ -10,18 +10,15 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { KpiSpecial, CreateKpiSpecial, UpdateKpiSpecial } from "../entities/kpiSpecial";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import { Brackets, IsNull, Like, Not } from "typeorm";
|
||||
import { Brackets, Not } from "typeorm";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
@Route("api/v1/kpi/special")
|
||||
|
|
@ -45,7 +42,7 @@ export class kpiSpecialController extends Controller {
|
|||
@Body() requestBody: CreateKpiSpecial,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request,"SYS_EVA_INDICATOR");
|
||||
await new permission().PermissionCreate(request, "SYS_EVA_INDICATOR");
|
||||
const chk_kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||
where: {
|
||||
including: String(requestBody.including),
|
||||
|
|
@ -82,7 +79,7 @@ export class kpiSpecialController extends Controller {
|
|||
@Body() requestBody: UpdateKpiSpecial,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request,"SYS_EVA_INDICATOR");
|
||||
await new permission().PermissionUpdate(request, "SYS_EVA_INDICATOR");
|
||||
const kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -115,7 +112,8 @@ export class kpiSpecialController extends Controller {
|
|||
* @param id Guid, *Id ตัวชี้วัด Special
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetKpiSpecialById(@Path() id: string) {
|
||||
async GetKpiSpecialById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
const KpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -156,6 +154,7 @@ export class kpiSpecialController extends Controller {
|
|||
*/
|
||||
@Post("search")
|
||||
async listKpiSpecial(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
|
|
@ -165,6 +164,7 @@ export class kpiSpecialController extends Controller {
|
|||
keyword?: string | null;
|
||||
},
|
||||
) {
|
||||
let _data = await new permission().PermissionList(request, "SYS_EVA_INDICATOR");
|
||||
// let condition: any = {};
|
||||
// if (requestBody.keyword !== undefined && requestBody.keyword !== "") {
|
||||
// condition = {
|
||||
|
|
@ -216,8 +216,8 @@ export class kpiSpecialController extends Controller {
|
|||
* @param id
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiSpecial(@Path() id: string, @Request() request: RequestWithUser,) {
|
||||
await new permission().PermissionDelete(request,"SYS_EVA_INDICATOR");
|
||||
async deleteKpiSpecial(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_EVA_INDICATOR");
|
||||
const kpiSpecial = await this.kpiSpecialRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
ArrayValidator,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
|
|
@ -23,11 +21,9 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import { KpiCapacity } from "../entities/kpiCapacity";
|
||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import { KpiUserCapacity, KpiUserCapacityDataPoint } from "../entities/kpiUserCapacity";
|
||||
import { Like, In, Not } from "typeorm";
|
||||
import { Double } from "typeorm/browser";
|
||||
import { Not } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { request } from "axios";
|
||||
|
||||
@Route("api/v1/kpi/user/capacity")
|
||||
@Tags("kpiUserCapacity")
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import {
|
|||
} from "../entities/kpiUserDevelopment";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import { Not, Like, Brackets } from "typeorm";
|
||||
import { Not, Brackets } from "typeorm";
|
||||
import { DevelopmentProject } from "../entities/developmentProject";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@ import {
|
|||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
ArrayValidator,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
|
|
@ -31,7 +29,7 @@ import {
|
|||
updateKpiUserReqEditEvaluation,
|
||||
updateKpiUserResultEvaluation,
|
||||
} from "../entities/kpiUserEvaluation";
|
||||
import { Like, In, Brackets, IsNull, Not } from "typeorm";
|
||||
import { In, Brackets, IsNull, Not } from "typeorm";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import { KpiCapacity } from "../entities/kpiCapacity";
|
||||
import { Position } from "../entities/position";
|
||||
|
|
@ -249,27 +247,27 @@ export class KpiUserEvaluationController extends Controller {
|
|||
qb.orWhere("kpiUserEvaluation.prefix LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.org LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.position LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere(conditionFullName, {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.org LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.position LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere(conditionFullName, {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
});
|
||||
}),
|
||||
)
|
||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@ import {
|
|||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Patch,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@ import {
|
|||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Patch,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
|
|
|
|||
|
|
@ -1,25 +1,11 @@
|
|||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Query,
|
||||
} from "tsoa";
|
||||
import { Controller, Get, Post, Route, Security, Tags, Body, Path, Request } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { Brackets, IsNull, Not, In } from "typeorm";
|
||||
import { In } from "typeorm";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { KpiPeriod } from "../entities/kpiPeriod";
|
||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||
import { off } from "process";
|
||||
import Extension from "../interfaces/extension";
|
||||
import { KpiRole } from "../entities/kpiRole";
|
||||
import { KpiPlan } from "../entities/kpiPlan";
|
||||
|
|
@ -75,7 +61,7 @@ export class ReportController extends Controller {
|
|||
where: {
|
||||
kpiPeriodId: requestBody.periodId,
|
||||
orgId: requestBody.root,
|
||||
evaluationStatus: "KP7"
|
||||
evaluationStatus: "KP7",
|
||||
},
|
||||
});
|
||||
data = {
|
||||
|
|
@ -121,7 +107,7 @@ export class ReportController extends Controller {
|
|||
const userEvaluationOrg = await this.kpiUserEvaluationRepository.find({
|
||||
where: {
|
||||
orgId: String(requestBody?.root),
|
||||
kpiPeriodId: String(requestBody?.periodId)
|
||||
kpiPeriodId: String(requestBody?.periodId),
|
||||
// child1Id: "" || IsNull(),
|
||||
// child2Id: "" || IsNull(),
|
||||
// child3Id: "" || IsNull(),
|
||||
|
|
@ -135,16 +121,16 @@ export class ReportController extends Controller {
|
|||
const result =
|
||||
userEvaluationOrg.length > 0
|
||||
? Extension.ToThaiNumber(
|
||||
userEvaluationOrg
|
||||
.filter((x: any) => x.evaluationStatus == "KP7")
|
||||
.length.toString(),
|
||||
userEvaluationOrg.filter((x: any) => x.evaluationStatus == "KP7").length.toString(),
|
||||
)
|
||||
: "๐";
|
||||
const excellent =
|
||||
userEvaluationOrg.length > 0
|
||||
? Extension.ToThaiNumber(
|
||||
userEvaluationOrg
|
||||
.filter((x: any) => x.evaluationResults == "EXCELLENT" && x.evaluationStatus == "KP7")
|
||||
.filter(
|
||||
(x: any) => x.evaluationResults == "EXCELLENT" && x.evaluationStatus == "KP7",
|
||||
)
|
||||
.length.toString(),
|
||||
)
|
||||
: "๐";
|
||||
|
|
@ -152,7 +138,9 @@ export class ReportController extends Controller {
|
|||
userEvaluationOrg.length > 0
|
||||
? Extension.ToThaiNumber(
|
||||
userEvaluationOrg
|
||||
.filter((x: any) => x.evaluationResults == "VERY_GOOD" && x.evaluationStatus == "KP7")
|
||||
.filter(
|
||||
(x: any) => x.evaluationResults == "VERY_GOOD" && x.evaluationStatus == "KP7",
|
||||
)
|
||||
.length.toString(),
|
||||
)
|
||||
: "๐";
|
||||
|
|
@ -160,23 +148,25 @@ export class ReportController extends Controller {
|
|||
userEvaluationOrg.length > 0
|
||||
? Extension.ToThaiNumber(
|
||||
userEvaluationOrg
|
||||
.filter((x: any) => x.evaluationResults == "GOOD" && x.evaluationStatus == "KP7")
|
||||
.length.toString(),
|
||||
.filter((x: any) => x.evaluationResults == "GOOD" && x.evaluationStatus == "KP7")
|
||||
.length.toString(),
|
||||
)
|
||||
: "๐";
|
||||
const fair =
|
||||
userEvaluationOrg.length > 0
|
||||
? Extension.ToThaiNumber(
|
||||
userEvaluationOrg
|
||||
.filter((x: any) => x.evaluationResults == "FAIR" && x.evaluationStatus == "KP7")
|
||||
.length.toString(),
|
||||
.filter((x: any) => x.evaluationResults == "FAIR" && x.evaluationStatus == "KP7")
|
||||
.length.toString(),
|
||||
)
|
||||
: "๐";
|
||||
const improvment =
|
||||
userEvaluationOrg.length > 0
|
||||
? Extension.ToThaiNumber(
|
||||
userEvaluationOrg
|
||||
.filter((x: any) => x.evaluationResults == "IMPROVEMENT" && x.evaluationStatus == "KP7")
|
||||
.filter(
|
||||
(x: any) => x.evaluationResults == "IMPROVEMENT" && x.evaluationStatus == "KP7",
|
||||
)
|
||||
.length.toString(),
|
||||
)
|
||||
: "๐";
|
||||
|
|
@ -481,103 +471,103 @@ export class ReportController extends Controller {
|
|||
.select("MIN(kpiUserEvaluation.id) as id")
|
||||
.getRawMany();
|
||||
|
||||
// const profileEvaluationNextYearIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
// .createQueryBuilder("kpiUserEvaluation")
|
||||
// .leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||
// .where("kpiPeriod.year = :year", { year: yearNow + 1 })
|
||||
// .groupBy("kpiUserEvaluation.kpiPeriodId")
|
||||
// .select("MIN(kpiUserEvaluation.id) as id")
|
||||
// .getRawMany();
|
||||
// const profileEvaluationCombianIds = profileEvaluationNowYearIds.concat(profileEvaluationNextYearIds);
|
||||
// const profileEvaluationNextYearIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
// .createQueryBuilder("kpiUserEvaluation")
|
||||
// .leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||
// .where("kpiPeriod.year = :year", { year: yearNow + 1 })
|
||||
// .groupBy("kpiUserEvaluation.kpiPeriodId")
|
||||
// .select("MIN(kpiUserEvaluation.id) as id")
|
||||
// .getRawMany();
|
||||
// const profileEvaluationCombianIds = profileEvaluationNowYearIds.concat(profileEvaluationNextYearIds);
|
||||
|
||||
//ชั่วคราว
|
||||
const profileEvaluations = await this.kpiUserEvaluationRepository.find({
|
||||
relations: ["kpiPeriod"],
|
||||
where: { id: In(profileEvaluationNowYearIds.map((evaluation) => evaluation.id)) },
|
||||
});
|
||||
//ชั่วคราว
|
||||
const profileEvaluations = await this.kpiUserEvaluationRepository.find({
|
||||
relations: ["kpiPeriod"],
|
||||
where: { id: In(profileEvaluationNowYearIds.map((evaluation) => evaluation.id)) },
|
||||
});
|
||||
|
||||
const groupedEvaluations = profileEvaluations.reduce((acc: any, evaluation: any) => {
|
||||
const year = evaluation.kpiPeriod.year;
|
||||
const profileId = evaluation.profileId;
|
||||
const key = `${profileId}-${year}`;
|
||||
const groupedEvaluations = profileEvaluations.reduce((acc: any, evaluation: any) => {
|
||||
const year = evaluation.kpiPeriod.year;
|
||||
const profileId = evaluation.profileId;
|
||||
const key = `${profileId}-${year}`;
|
||||
|
||||
if (!acc[key]) {
|
||||
acc[key] = {
|
||||
fullName: evaluation.prefix + evaluation.firstName + " " + evaluation.lastName,
|
||||
profileId: profileId,
|
||||
year: year ? Extension.ToThaiNumber(Extension.ToThaiYear(year).toString()) : null,
|
||||
evaluations: [],
|
||||
};
|
||||
}
|
||||
if (!acc[key]) {
|
||||
acc[key] = {
|
||||
fullName: evaluation.prefix + evaluation.firstName + " " + evaluation.lastName,
|
||||
profileId: profileId,
|
||||
year: year ? Extension.ToThaiNumber(Extension.ToThaiYear(year).toString()) : null,
|
||||
evaluations: [],
|
||||
};
|
||||
}
|
||||
|
||||
acc[key].evaluations.push(evaluation);
|
||||
return acc;
|
||||
}, {});
|
||||
acc[key].evaluations.push(evaluation);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// สร้าง formatData
|
||||
combinedDatas = Object.values(groupedEvaluations).map((group: any) => {
|
||||
const data: any = {
|
||||
fullName: group.fullName ?? null,
|
||||
year: group.year ?? null,
|
||||
};
|
||||
// สร้าง formatData
|
||||
combinedDatas = Object.values(groupedEvaluations).map((group: any) => {
|
||||
const data: any = {
|
||||
fullName: group.fullName ?? null,
|
||||
year: group.year ?? null,
|
||||
};
|
||||
|
||||
group.evaluations.forEach((evaluation: any) => {
|
||||
if (evaluation.kpiPeriod.durationKPI === "APR") {
|
||||
data.summaryPointAPR1 =
|
||||
evaluation.summaryPoint >= 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR2 =
|
||||
evaluation.summaryPoint >= 80 && evaluation.summaryPoint < 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR3 =
|
||||
evaluation.summaryPoint >= 70 && evaluation.summaryPoint < 80
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR4 =
|
||||
evaluation.summaryPoint >= 60 && evaluation.summaryPoint < 70
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR5 =
|
||||
evaluation.summaryPoint < 60
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.periodAPR = evaluation.kpiPeriod.durationKPI;
|
||||
} else if (evaluation.kpiPeriod.durationKPI === "OCT") {
|
||||
data.summaryPointOCT1 =
|
||||
evaluation.summaryPoint >= 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT2 =
|
||||
evaluation.summaryPoint >= 80 && evaluation.summaryPoint < 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT3 =
|
||||
evaluation.summaryPoint >= 70 && evaluation.summaryPoint < 80
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT4 =
|
||||
evaluation.summaryPoint >= 60 && evaluation.summaryPoint < 70
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT5 =
|
||||
evaluation.summaryPoint < 60
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.periodOCT = evaluation.kpiPeriod.durationKPI ?? null;
|
||||
}
|
||||
});
|
||||
group.evaluations.forEach((evaluation: any) => {
|
||||
if (evaluation.kpiPeriod.durationKPI === "APR") {
|
||||
data.summaryPointAPR1 =
|
||||
evaluation.summaryPoint >= 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR2 =
|
||||
evaluation.summaryPoint >= 80 && evaluation.summaryPoint < 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR3 =
|
||||
evaluation.summaryPoint >= 70 && evaluation.summaryPoint < 80
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR4 =
|
||||
evaluation.summaryPoint >= 60 && evaluation.summaryPoint < 70
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointAPR5 =
|
||||
evaluation.summaryPoint < 60
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.periodAPR = evaluation.kpiPeriod.durationKPI;
|
||||
} else if (evaluation.kpiPeriod.durationKPI === "OCT") {
|
||||
data.summaryPointOCT1 =
|
||||
evaluation.summaryPoint >= 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT2 =
|
||||
evaluation.summaryPoint >= 80 && evaluation.summaryPoint < 90
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT3 =
|
||||
evaluation.summaryPoint >= 70 && evaluation.summaryPoint < 80
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT4 =
|
||||
evaluation.summaryPoint >= 60 && evaluation.summaryPoint < 70
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.summaryPointOCT5 =
|
||||
evaluation.summaryPoint < 60
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.periodOCT = evaluation.kpiPeriod.durationKPI ?? null;
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
});
|
||||
}
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
formattedData = {
|
||||
combinedDatas: combinedDatas.length > 0 ? combinedDatas : [{}],
|
||||
fullName: combinedDatas.length > 0?combinedDatas[0]["fullName"]:"-",
|
||||
};
|
||||
formattedData = {
|
||||
combinedDatas: combinedDatas.length > 0 ? combinedDatas : [{}],
|
||||
fullName: combinedDatas.length > 0 ? combinedDatas[0]["fullName"] : "-",
|
||||
};
|
||||
}
|
||||
if (requestBody.type == "KPI5") {
|
||||
templateName = "KPI5";
|
||||
|
|
@ -651,164 +641,193 @@ export class ReportController extends Controller {
|
|||
.select("MIN(kpiUserEvaluation.id) as id")
|
||||
.getRawMany();
|
||||
// if (profileEvaluationIds.length > 0) {
|
||||
const profileEvaluation = await this.kpiUserEvaluationRepository.find({
|
||||
relations: ["kpiPeriod"],
|
||||
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
|
||||
});
|
||||
const profileEvaluation = await this.kpiUserEvaluationRepository.find({
|
||||
relations: ["kpiPeriod"],
|
||||
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
|
||||
});
|
||||
|
||||
const combinedData: KPIData = profileEvaluation.reduce(
|
||||
(acc: KPIData, x) => {
|
||||
const fullNameParts = [x.child4, x.child3, x.child2, x.child1, x.org];
|
||||
const combinedData: KPIData = profileEvaluation.reduce(
|
||||
(acc: KPIData, x) => {
|
||||
const fullNameParts = [x.child4, x.child3, x.child2, x.child1, x.org];
|
||||
|
||||
const affiliation = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
const affiliation = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
if (!acc.fullName) {
|
||||
acc.fullName = x.prefix + " " + x.firstName + " " + x.lastName;
|
||||
acc.position = x.position;
|
||||
acc.posType = x.posTypeName;
|
||||
acc.posLevel = x.posLevelName;
|
||||
acc.affiliation = affiliation;
|
||||
}
|
||||
if (!acc.fullName) {
|
||||
acc.fullName = x.prefix + " " + x.firstName + " " + x.lastName;
|
||||
acc.position = x.position;
|
||||
acc.posType = x.posTypeName;
|
||||
acc.posLevel = x.posLevelName;
|
||||
acc.affiliation = affiliation;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 4 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR1 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointAPR1 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR1 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 4 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR1 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR1 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR1 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 4 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT1 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointOCT1 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT1 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 4 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT1 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT1 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT1 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 3 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR2 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointAPR2 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR2 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 3 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR2 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR2 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR2 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 3 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT2 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointOCT2 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT2 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 3 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT2 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT2 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT2 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR3 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointAPR3 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR3 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR3 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR3 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR3 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT3 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointOCT3 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT3 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT3 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT3 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT3 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR4 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointAPR4 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR4 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR4 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR4 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR4 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR4 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR4 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT4 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointOCT4 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT4 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT4 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT4 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT4 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT4 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT4 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR5 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointAPR5 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR5 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR5 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR5 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR5 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR5 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR5 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT5 = x.summaryPoint ? Extension.ToThaiNumber(x.summaryPoint.toString()) : null;
|
||||
acc.textPointOCT5 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT5 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT5 =
|
||||
x.kpiPeriod.year ? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()) : null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT5 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT5 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT5 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT5 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
fullName: null,
|
||||
position: null,
|
||||
posType: null,
|
||||
posLevel: null,
|
||||
affiliation: null,
|
||||
summaryPointAPR1: null,
|
||||
textPointAPR1: null,
|
||||
periodAPR1: null,
|
||||
yearAPR1: null,
|
||||
summaryPointOCT1: null,
|
||||
textPointOCT1: null,
|
||||
periodOCT1: null,
|
||||
yearOCT1: null,
|
||||
summaryPointAPR2: null,
|
||||
textPointAPR2: null,
|
||||
periodAPR2: null,
|
||||
yearAPR2: null,
|
||||
summaryPointOCT2: null,
|
||||
textPointOCT2: null,
|
||||
periodOCT2: null,
|
||||
yearOCT2: null,
|
||||
summaryPointAPR3: null,
|
||||
textPointAPR3: null,
|
||||
periodAPR3: null,
|
||||
yearAPR3: null,
|
||||
summaryPointOCT3: null,
|
||||
textPointOCT3: null,
|
||||
periodOCT3: null,
|
||||
yearOCT3: null,
|
||||
summaryPointAPR4: null,
|
||||
textPointAPR4: null,
|
||||
periodAPR4: null,
|
||||
yearAPR4: null,
|
||||
summaryPointOCT4: null,
|
||||
textPointOCT4: null,
|
||||
periodOCT4: null,
|
||||
yearOCT4: null,
|
||||
summaryPointAPR5: null,
|
||||
textPointAPR5: null,
|
||||
periodAPR5: null,
|
||||
yearAPR5: null,
|
||||
summaryPointOCT5: null,
|
||||
textPointOCT5: null,
|
||||
periodOCT5: null,
|
||||
yearOCT5: null,
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 4).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 3).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year4: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year5: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
},
|
||||
);
|
||||
formattedData = combinedData;
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
fullName: null,
|
||||
position: null,
|
||||
posType: null,
|
||||
posLevel: null,
|
||||
affiliation: null,
|
||||
summaryPointAPR1: null,
|
||||
textPointAPR1: null,
|
||||
periodAPR1: null,
|
||||
yearAPR1: null,
|
||||
summaryPointOCT1: null,
|
||||
textPointOCT1: null,
|
||||
periodOCT1: null,
|
||||
yearOCT1: null,
|
||||
summaryPointAPR2: null,
|
||||
textPointAPR2: null,
|
||||
periodAPR2: null,
|
||||
yearAPR2: null,
|
||||
summaryPointOCT2: null,
|
||||
textPointOCT2: null,
|
||||
periodOCT2: null,
|
||||
yearOCT2: null,
|
||||
summaryPointAPR3: null,
|
||||
textPointAPR3: null,
|
||||
periodAPR3: null,
|
||||
yearAPR3: null,
|
||||
summaryPointOCT3: null,
|
||||
textPointOCT3: null,
|
||||
periodOCT3: null,
|
||||
yearOCT3: null,
|
||||
summaryPointAPR4: null,
|
||||
textPointAPR4: null,
|
||||
periodAPR4: null,
|
||||
yearAPR4: null,
|
||||
summaryPointOCT4: null,
|
||||
textPointOCT4: null,
|
||||
periodOCT4: null,
|
||||
yearOCT4: null,
|
||||
summaryPointAPR5: null,
|
||||
textPointAPR5: null,
|
||||
periodAPR5: null,
|
||||
yearAPR5: null,
|
||||
summaryPointOCT5: null,
|
||||
textPointOCT5: null,
|
||||
periodOCT5: null,
|
||||
yearOCT5: null,
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 4).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 3).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year4: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year5: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
},
|
||||
);
|
||||
formattedData = combinedData;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -867,113 +886,131 @@ export class ReportController extends Controller {
|
|||
.select("MIN(kpiUserEvaluation.id) as id")
|
||||
.getRawMany();
|
||||
// if (profileEvaluationIds.length > 0) {
|
||||
const profileEvaluation = await this.kpiUserEvaluationRepository.find({
|
||||
relations: ["kpiPeriod"],
|
||||
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
|
||||
});
|
||||
const profileEvaluation = await this.kpiUserEvaluationRepository.find({
|
||||
relations: ["kpiPeriod"],
|
||||
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
|
||||
});
|
||||
|
||||
const combinedData: KPIData = profileEvaluation.reduce(
|
||||
(acc: KPIData, x) => {
|
||||
const fullNameParts = [x.child4, x.child3, x.child2, x.child1, x.org];
|
||||
const combinedData: KPIData = profileEvaluation.reduce(
|
||||
(acc: KPIData, x) => {
|
||||
const fullNameParts = [x.child4, x.child3, x.child2, x.child1, x.org];
|
||||
|
||||
const affiliation = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
const affiliation = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
if (!acc.fullName) {
|
||||
acc.fullName = x.prefix + " " + x.firstName + " " + x.lastName;
|
||||
acc.position = x.position;
|
||||
acc.posType = x.posTypeName;
|
||||
acc.posLevel = x.posLevelName;
|
||||
acc.affiliation = affiliation;
|
||||
}
|
||||
if (!acc.fullName) {
|
||||
acc.fullName = x.prefix + " " + x.firstName + " " + x.lastName;
|
||||
acc.position = x.position;
|
||||
acc.posType = x.posTypeName;
|
||||
acc.posLevel = x.posLevelName;
|
||||
acc.affiliation = affiliation;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR1 = x.summaryPoint?Extension.ToThaiNumber(x.summaryPoint.toString()):null;
|
||||
acc.textPointAPR1 = x.summaryPoint?Extension.textPoint(x.summaryPoint):null;
|
||||
acc.periodAPR1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR1 =
|
||||
x.kpiPeriod.year?Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()):null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR1 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR1 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR1 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT1 = x.summaryPoint?Extension.ToThaiNumber(x.summaryPoint.toString()):null;
|
||||
acc.textPointOCT1 = x.summaryPoint?Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT1 =
|
||||
x.kpiPeriod.year?Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()):null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 2 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT1 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT1 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT1 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT1 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR2 = x.summaryPoint?Extension.ToThaiNumber(x.summaryPoint.toString()):null;
|
||||
acc.textPointAPR2 = x.summaryPoint?Extension.textPoint(x.summaryPoint):null;
|
||||
acc.periodAPR2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR2 =
|
||||
x.kpiPeriod.year?Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()):null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR2 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR2 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR2 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT2 = x.summaryPoint?Extension.ToThaiNumber(x.summaryPoint.toString()):null;
|
||||
acc.textPointOCT2 = x.summaryPoint?Extension.textPoint(x.summaryPoint):null;
|
||||
acc.periodOCT2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT2 =
|
||||
x.kpiPeriod.year?Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()):null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow - 1 && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT2 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT2 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT2 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT2 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR3 = x.summaryPoint?Extension.ToThaiNumber(x.summaryPoint.toString()):null;
|
||||
acc.textPointAPR3 = x.summaryPoint?Extension.textPoint(x.summaryPoint):null;
|
||||
acc.periodAPR3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR3 =
|
||||
x.kpiPeriod.year?Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()):null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "APR") {
|
||||
acc.summaryPointAPR3 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointAPR3 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodAPR3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearAPR3 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT3 = x.summaryPoint?Extension.ToThaiNumber(x.summaryPoint.toString()):null;
|
||||
acc.textPointOCT3 = x.summaryPoint?Extension.textPoint(x.summaryPoint):null;
|
||||
acc.periodOCT3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT3 =
|
||||
x.kpiPeriod.year?Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString()):null;
|
||||
}
|
||||
if (x.kpiPeriod.year === yearNow && x.kpiPeriod.durationKPI === "OCT") {
|
||||
acc.summaryPointOCT3 = x.summaryPoint
|
||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||
: null;
|
||||
acc.textPointOCT3 = x.summaryPoint ? Extension.textPoint(x.summaryPoint) : null;
|
||||
acc.periodOCT3 = x.kpiPeriod.durationKPI;
|
||||
acc.yearOCT3 = x.kpiPeriod.year
|
||||
? Extension.ToThaiNumber(Extension.ToThaiYear(x.kpiPeriod.year).toString())
|
||||
: null;
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
fullName: null,
|
||||
position: null,
|
||||
posType: null,
|
||||
posLevel: null,
|
||||
affiliation: null,
|
||||
summaryPointAPR1: null,
|
||||
textPointAPR1: null,
|
||||
periodAPR1: null,
|
||||
yearAPR1: null,
|
||||
summaryPointOCT1: null,
|
||||
textPointOCT1: null,
|
||||
periodOCT1: null,
|
||||
yearOCT1: null,
|
||||
summaryPointAPR2: null,
|
||||
textPointAPR2: null,
|
||||
periodAPR2: null,
|
||||
yearAPR2: null,
|
||||
summaryPointOCT2: null,
|
||||
textPointOCT2: null,
|
||||
periodOCT2: null,
|
||||
yearOCT2: null,
|
||||
summaryPointAPR3: null,
|
||||
textPointAPR3: null,
|
||||
periodAPR3: null,
|
||||
yearAPR3: null,
|
||||
summaryPointOCT3: null,
|
||||
textPointOCT3: null,
|
||||
periodOCT3: null,
|
||||
yearOCT3: null,
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
},
|
||||
);
|
||||
formattedData = combinedData;
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
fullName: null,
|
||||
position: null,
|
||||
posType: null,
|
||||
posLevel: null,
|
||||
affiliation: null,
|
||||
summaryPointAPR1: null,
|
||||
textPointAPR1: null,
|
||||
periodAPR1: null,
|
||||
yearAPR1: null,
|
||||
summaryPointOCT1: null,
|
||||
textPointOCT1: null,
|
||||
periodOCT1: null,
|
||||
yearOCT1: null,
|
||||
summaryPointAPR2: null,
|
||||
textPointAPR2: null,
|
||||
periodAPR2: null,
|
||||
yearAPR2: null,
|
||||
summaryPointOCT2: null,
|
||||
textPointOCT2: null,
|
||||
periodOCT2: null,
|
||||
yearOCT2: null,
|
||||
summaryPointAPR3: null,
|
||||
textPointAPR3: null,
|
||||
periodAPR3: null,
|
||||
yearAPR3: null,
|
||||
summaryPointOCT3: null,
|
||||
textPointOCT3: null,
|
||||
periodOCT3: null,
|
||||
yearOCT3: null,
|
||||
year1: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 2).toString()),
|
||||
year2: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow - 1).toString()),
|
||||
year3: Extension.ToThaiNumber(Extension.ToThaiYear(yearNow).toString()),
|
||||
},
|
||||
);
|
||||
formattedData = combinedData;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -984,8 +1021,8 @@ export class ReportController extends Controller {
|
|||
const userEvaluations_ = await Promise.all(
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations.map(async (x: any, idx: number) => {
|
||||
/*รอ Fe เพิ่ม UI*/
|
||||
// const target_ = await this.kpiUserDevelopmentRepository.findOne({
|
||||
/*รอ Fe เพิ่ม UI*/
|
||||
// const target_ = await this.kpiUserDevelopmentRepository.findOne({
|
||||
// where: { kpiUserEvaluationId: x.id },
|
||||
// });
|
||||
// const isDev70 = target_ && target_?.isDevelopment70 === true
|
||||
|
|
@ -1034,18 +1071,18 @@ export class ReportController extends Controller {
|
|||
templateName = "KPI8";
|
||||
reportName = "KPI8";
|
||||
//use_filter
|
||||
let period_:any
|
||||
let formattedUserDevelopmentLists:any
|
||||
let userInfo:any
|
||||
let userDevelopmentLists:any
|
||||
let fullNameParts:any
|
||||
let affiliation:any
|
||||
let period_: any;
|
||||
let formattedUserDevelopmentLists: any;
|
||||
let userInfo: any;
|
||||
let userDevelopmentLists: any;
|
||||
let fullNameParts: any;
|
||||
let affiliation: any;
|
||||
if (requestBody.profileId && requestBody.periodId) {
|
||||
period_ = await this.kpiPeriodRepository.findOne({
|
||||
where: { id: String(requestBody.periodId) }
|
||||
})
|
||||
if(period_ && !period1 && !period2) {
|
||||
if(period_?.durationKPI === "APR") {
|
||||
where: { id: String(requestBody.periodId) },
|
||||
});
|
||||
if (period_ && !period1 && !period2) {
|
||||
if (period_?.durationKPI === "APR") {
|
||||
period1 = `${Extension.ToThaiFullDate2(period_.startDate)} ถึง ${Extension.ToThaiFullDate2(period_.endDate)}`;
|
||||
let _period2 = await this.kpiPeriodRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1057,8 +1094,7 @@ export class ReportController extends Controller {
|
|||
period2 = _period2
|
||||
? `${Extension.ToThaiFullDate2(_period2?.startDate)} ถึง ${Extension.ToThaiFullDate2(_period2?.endDate)}`
|
||||
: "";
|
||||
}
|
||||
else if (period_?.durationKPI === "OCT"){
|
||||
} else if (period_?.durationKPI === "OCT") {
|
||||
period2 = `${Extension.ToThaiFullDate2(period_.startDate)} ถึง ${Extension.ToThaiFullDate2(period_.endDate)}`;
|
||||
let _period1 = await this.kpiPeriodRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1087,7 +1123,7 @@ export class ReportController extends Controller {
|
|||
userInfo = await this.kpiUserEvaluationRepository.find({
|
||||
where: {
|
||||
id: In(profileEvaluationIds.map((x: any) => x.id)),
|
||||
evaluationStatus: "KP7"
|
||||
evaluationStatus: "KP7",
|
||||
},
|
||||
});
|
||||
userDevelopmentLists = await this.kpiUserDevelopmentRepository.find({
|
||||
|
|
@ -1111,11 +1147,7 @@ export class ReportController extends Controller {
|
|||
const dev10text = "การลงมือปฏิบัติ (โดยผู้บังคับบัญชามอบหมาย)";
|
||||
const dev20text = "การเรียนรู้จากผู้อื่น (Coach/Mentor/Consulting)";
|
||||
const dev70text = "การลงมือปฏิบัติ (โดยผู้บังคับบัญชามอบหมาย)";
|
||||
const combianText = [
|
||||
dev10text,
|
||||
dev20text,
|
||||
dev70text
|
||||
];
|
||||
const combianText = [dev10text, dev20text, dev70text];
|
||||
|
||||
formattedUserDevelopmentLists = userDevelopmentLists.map(
|
||||
(development: any, index: number) => ({
|
||||
|
|
@ -1137,7 +1169,8 @@ export class ReportController extends Controller {
|
|||
development.isDevelopment20,
|
||||
development.isDevelopment70,
|
||||
]
|
||||
.map((x: any, index) => (x ? combianText[index]:null)).filter((x: any) => x !== null)
|
||||
.map((x: any, index) => (x ? combianText[index] : null))
|
||||
.filter((x: any) => x !== null)
|
||||
.join("/"),
|
||||
}),
|
||||
);
|
||||
|
|
@ -1150,12 +1183,12 @@ export class ReportController extends Controller {
|
|||
userInfo[0]?.org,
|
||||
];
|
||||
affiliation = fullNameParts
|
||||
.filter((part:any) => part !== undefined && part !== null)
|
||||
.filter((part: any) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
}
|
||||
}
|
||||
formattedData = {
|
||||
year: period_ ? Extension.ToThaiNumber((period_.year+543).toString()) : "-",
|
||||
year: period_ ? Extension.ToThaiNumber((period_.year + 543).toString()) : "-",
|
||||
fullName: userInfo
|
||||
? userInfo[0]?.prefix + userInfo[0]?.firstName + " " + userInfo[0]?.lastName
|
||||
: "-",
|
||||
|
|
@ -1166,26 +1199,29 @@ export class ReportController extends Controller {
|
|||
posLevel: userInfo ? userInfo[0]?.posLevelName : "-",
|
||||
period1: period1 ? Extension.ToThaiNumber(period1) : "-",
|
||||
period2: period2 ? Extension.ToThaiNumber(period2) : "-",
|
||||
developments:
|
||||
formattedUserDevelopmentLists ? formattedUserDevelopmentLists : [{}],
|
||||
developments: formattedUserDevelopmentLists ? formattedUserDevelopmentLists : [{}],
|
||||
};
|
||||
}
|
||||
if (requestBody.type == "KPI9") {
|
||||
templateName = "KPI9";
|
||||
reportName = "KPI9";
|
||||
const userEvaluations_ = data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
.filter((x: any) => x.evaluationResults == "EXCELLENT" || x.evaluationResults == "VERY_GOOD")
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||
position: x.position ? x.position : "",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||
evaluationResults: x.evaluationResults
|
||||
? Extension.EvaluationResult(x.evaluationResults)
|
||||
: "",
|
||||
}))
|
||||
: [{}]
|
||||
const userEvaluations_ =
|
||||
data.kpiUserEvaluations.length > 0
|
||||
? data.kpiUserEvaluations
|
||||
.filter(
|
||||
(x: any) =>
|
||||
x.evaluationResults == "EXCELLENT" || x.evaluationResults == "VERY_GOOD",
|
||||
)
|
||||
.map((x: any, idx: number) => ({
|
||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||
position: x.position ? x.position : "",
|
||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||
evaluationResults: x.evaluationResults
|
||||
? Extension.EvaluationResult(x.evaluationResults)
|
||||
: "",
|
||||
}))
|
||||
: [{}];
|
||||
formattedData = {
|
||||
root:
|
||||
data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
||||
|
|
|
|||
|
|
@ -1,16 +1,3 @@
|
|||
import {
|
||||
Controller,
|
||||
Request,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Patch,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Path,
|
||||
} from "tsoa";
|
||||
import axios from "axios";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import CallAPI from "./call-api";
|
||||
|
|
@ -26,23 +13,166 @@ class CheckAuth {
|
|||
) {
|
||||
return null;
|
||||
}
|
||||
await new CallAPI()
|
||||
return await new CallAPI()
|
||||
.GetData(req, "/org/permission")
|
||||
.then((x) => {
|
||||
let permission = false;
|
||||
let role = x.roles.find((x: any) => x.authSysId == system);
|
||||
if (!role) throw "ไม่มีสิทธิ์เข้าระบบ";
|
||||
if (role.attrOwnership == "OWNER") return "OWNER";
|
||||
if (action.trim().toLocaleUpperCase() == "CREATE") permission = role.attrIsCreate;
|
||||
if (action.trim().toLocaleUpperCase() == "DELETE") permission = role.attrIsDelete;
|
||||
if (action.trim().toLocaleUpperCase() == "GET") permission = role.attrIsGet;
|
||||
if (action.trim().toLocaleUpperCase() == "LIST") permission = role.attrIsList;
|
||||
if (action.trim().toLocaleUpperCase() == "UPDATE") permission = role.attrIsUpdate;
|
||||
if (role.attrOwnership == "OWNER") permission = true;
|
||||
if (permission == false) throw "ไม่มีสิทธิ์ใช้งานระบบนี้";
|
||||
return role.attrPrivilege;
|
||||
})
|
||||
.catch((x) => {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
if (x.status != undefined) {
|
||||
throw new HttpError(x.status, x.message);
|
||||
} else {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
}
|
||||
});
|
||||
}
|
||||
public async PermissionOrg(req: RequestWithUser, system: string, action: string) {
|
||||
if (
|
||||
req.headers.hasOwnProperty("api_key") &&
|
||||
req.headers["api_key"] &&
|
||||
req.headers["api_key"] == process.env.API_KEY
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
return await new CallAPI()
|
||||
.GetData(req, "/org/permission/org")
|
||||
.then(async (x) => {
|
||||
let privilege = null;
|
||||
if (action.trim().toLocaleUpperCase() == "CREATE")
|
||||
privilege = await this.PermissionCreate(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "DELETE")
|
||||
privilege = await this.PermissionDelete(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "GET")
|
||||
privilege = await this.PermissionGet(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "LIST")
|
||||
privilege = await this.PermissionList(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "UPDATE")
|
||||
privilege = await this.PermissionUpdate(req, system);
|
||||
|
||||
let data: any = {
|
||||
root: [null],
|
||||
child1: [null],
|
||||
child2: [null],
|
||||
child3: [null],
|
||||
child4: [null],
|
||||
};
|
||||
let node = 4;
|
||||
if (x.orgChild1Id == null) {
|
||||
node = 0;
|
||||
} else if (x.orgChild2Id == null) {
|
||||
node = 1;
|
||||
} else if (x.orgChild3Id == null) {
|
||||
node = 2;
|
||||
} else if (x.orgChild4Id == null) {
|
||||
node = 3;
|
||||
}
|
||||
if (privilege == "ROOT") {
|
||||
data = {
|
||||
root: [x.orgRootId],
|
||||
child1: null,
|
||||
child2: null,
|
||||
child3: null,
|
||||
child4: null,
|
||||
};
|
||||
} else if (privilege == "CHILD") {
|
||||
data = {
|
||||
root: node >= 0 ? [x.orgRootId] : null,
|
||||
child1: node >= 1 ? [x.orgChild1Id] : null,
|
||||
child2: node >= 2 ? [x.orgChild2Id] : null,
|
||||
child3: node >= 3 ? [x.orgChild3Id] : null,
|
||||
child4: node >= 4 ? [x.orgChild4Id] : null,
|
||||
};
|
||||
} else if (privilege == "NORMAL") {
|
||||
data = {
|
||||
root: [x.orgRootId],
|
||||
child1: [x.orgChild1Id],
|
||||
child2: [x.orgChild2Id],
|
||||
child3: [x.orgChild3Id],
|
||||
child4: [x.orgChild4Id],
|
||||
};
|
||||
} else if (privilege == "SPECIFIC") {
|
||||
} else if (privilege == "OWNER") {
|
||||
data = {
|
||||
root: null,
|
||||
child1: null,
|
||||
child2: null,
|
||||
child3: null,
|
||||
child4: null,
|
||||
};
|
||||
}
|
||||
|
||||
return data;
|
||||
})
|
||||
.catch((x) => {
|
||||
if (x.status != undefined) {
|
||||
throw new HttpError(x.status, x.message);
|
||||
} else {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
}
|
||||
});
|
||||
}
|
||||
public async PermissionOrgByUser(
|
||||
req: RequestWithUser,
|
||||
system: string,
|
||||
action: string,
|
||||
profileId: string,
|
||||
) {
|
||||
if (
|
||||
req.headers.hasOwnProperty("api_key") &&
|
||||
req.headers["api_key"] &&
|
||||
req.headers["api_key"] == process.env.API_KEY
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return await new CallAPI()
|
||||
.GetData(req, `/org/permission/user/${profileId}`)
|
||||
.then(async (x) => {
|
||||
let org = {
|
||||
root: [null],
|
||||
child1: [null],
|
||||
child2: [null],
|
||||
child3: [null],
|
||||
child4: [null],
|
||||
};
|
||||
if (action.trim().toLocaleUpperCase() == "CREATE")
|
||||
org = await this.PermissionOrgCreate(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "DELETE")
|
||||
org = await this.PermissionOrgDelete(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "GET")
|
||||
org = await this.PermissionOrgGet(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "LIST")
|
||||
org = await this.PermissionOrgList(req, system);
|
||||
if (action.trim().toLocaleUpperCase() == "UPDATE")
|
||||
org = await this.PermissionOrgUpdate(req, system);
|
||||
|
||||
if (org.root != null) if (x.orgRootId != org.root[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล";
|
||||
if (org.child1 != null)
|
||||
if (x.orgChild1Id != org.child1[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล";
|
||||
if (org.child2 != null)
|
||||
if (x.orgChild2Id != org.child2[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล";
|
||||
if (org.child3 != null)
|
||||
if (x.orgChild3Id != org.child3[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล";
|
||||
if (org.child4 != null)
|
||||
if (x.orgChild4Id != org.child4[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล";
|
||||
|
||||
return true;
|
||||
})
|
||||
.catch((x) => {
|
||||
if (x.status != undefined) {
|
||||
throw new HttpError(x.status, x.message);
|
||||
} else {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
}
|
||||
});
|
||||
}
|
||||
public async PermissionCreate(req: RequestWithUser, system: string) {
|
||||
|
|
@ -60,6 +190,38 @@ class CheckAuth {
|
|||
public async PermissionUpdate(req: RequestWithUser, system: string) {
|
||||
return await this.Permission(req, system, "UPDATE");
|
||||
}
|
||||
|
||||
public async PermissionOrgCreate(req: RequestWithUser, system: string) {
|
||||
return await this.PermissionOrg(req, system, "CREATE");
|
||||
}
|
||||
public async PermissionOrgDelete(req: RequestWithUser, system: string) {
|
||||
return await this.PermissionOrg(req, system, "DELETE");
|
||||
}
|
||||
public async PermissionOrgGet(req: RequestWithUser, system: string) {
|
||||
return await this.PermissionOrg(req, system, "GET");
|
||||
}
|
||||
public async PermissionOrgList(req: RequestWithUser, system: string) {
|
||||
return await this.PermissionOrg(req, system, "LIST");
|
||||
}
|
||||
public async PermissionOrgUpdate(req: RequestWithUser, system: string) {
|
||||
return await this.PermissionOrg(req, system, "UPDATE");
|
||||
}
|
||||
|
||||
public async PermissionOrgUserCreate(req: RequestWithUser, system: string, profileId: string) {
|
||||
return await this.PermissionOrgByUser(req, system, "CREATE", profileId);
|
||||
}
|
||||
public async PermissionOrgUserDelete(req: RequestWithUser, system: string, profileId: string) {
|
||||
return await this.PermissionOrgByUser(req, system, "DELETE", profileId);
|
||||
}
|
||||
public async PermissionOrgUserGet(req: RequestWithUser, system: string, profileId: string) {
|
||||
return await this.PermissionOrgByUser(req, system, "GET", profileId);
|
||||
}
|
||||
public async PermissionOrgUserList(req: RequestWithUser, system: string, profileId: string) {
|
||||
return await this.PermissionOrgByUser(req, system, "LIST", profileId);
|
||||
}
|
||||
public async PermissionOrgUserUpdate(req: RequestWithUser, system: string, profileId: string) {
|
||||
return await this.PermissionOrgByUser(req, system, "UPDATE", profileId);
|
||||
}
|
||||
}
|
||||
|
||||
export default CheckAuth;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue