permission ข้อมูลการประเมิน

This commit is contained in:
Bright 2024-08-08 14:17:10 +07:00
parent 26492de4b8
commit 75ed79f722
9 changed files with 123 additions and 23 deletions

View file

@ -24,6 +24,8 @@ import { KpiLink, createKpiLink, updateKpiLink } from "../entities/kpiLink";
import { KpiGroup } from "../entities/kpiGroup";
import { KpiCapacity } from "../entities/kpiCapacity";
import { Position } from "../entities/position";
import permission from "../interfaces/permission";
import { RequestWithUser } from "../middlewares/user";
@Route("api/v1/kpi/link")
@Tags("kpiLink")
@Security("bearerAuth")
@ -46,8 +48,9 @@ export class kpiLinkController extends Controller {
@Post()
async createKpiLink(
@Body() requestBody: createKpiLink,
@Request() request: { user: Record<string, any> },
@Request() request: RequestWithUser,
) {
await new permission().PermissionCreate(request,"SYS_EVA_COMPETENCY");
const chkkpiGroup = await this.kpiGroupRepository.findOne({
where: {
id: requestBody.kpiGroupId,
@ -105,8 +108,9 @@ export class kpiLinkController extends Controller {
async updateKpiLink(
@Path() id: string,
@Body() requestBody: createKpiLink,
@Request() request: { user: Record<string, any> },
@Request() request: RequestWithUser,
) {
await new permission().PermissionUpdate(request,"SYS_EVA_COMPETENCY");
const chkKpiLink = await this.kpiLinkRepository.findOne({
where: {
id: id,
@ -198,7 +202,8 @@ export class kpiLinkController extends Controller {
* @param id
*/
@Delete("{id}")
async deleteKpiLink(@Path() id: string) {
async deleteKpiLink(@Path() id: string, @Request() request: RequestWithUser) {
await new permission().PermissionDelete(request,"SYS_EVA_COMPETENCY");
const kpiLink = await this.kpiLinkRepository.findOne({
where: { id: id },
relations: ["kpiCapacitys"],