role
This commit is contained in:
parent
75ed79f722
commit
23df3da9b0
7 changed files with 65 additions and 25 deletions
|
|
@ -25,6 +25,9 @@ import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
|||
import { KpiUserCapacity, KpiUserCapacityDataPoint } from "../entities/kpiUserCapacity";
|
||||
import { Like, In, Not } from "typeorm";
|
||||
import { Double } from "typeorm/browser";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { request } from "axios";
|
||||
|
||||
@Route("api/v1/kpi/user/capacity")
|
||||
@Tags("kpiUserCapacity")
|
||||
|
|
@ -55,8 +58,9 @@ export class KpiUserCapacityController extends Controller {
|
|||
level: string | null;
|
||||
weight: number;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_KPI_LIST");
|
||||
const kpiUserEvalution = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: requestBody.kpiUserEvaluationId },
|
||||
});
|
||||
|
|
@ -110,8 +114,9 @@ export class KpiUserCapacityController extends Controller {
|
|||
level: string;
|
||||
weight: number;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_KPI_LIST");
|
||||
const kpiUserEvalution = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: requestBody.kpiUserEvaluationId },
|
||||
});
|
||||
|
|
@ -229,7 +234,8 @@ export class KpiUserCapacityController extends Controller {
|
|||
* @param {string} id Guid, *Id องค์ประกอบที่ 2 พฤติกรรมการปฎิบัติราชการ (สมรรถนะ) (USER)
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiUserCapacity(@Path() id: string) {
|
||||
async deleteKpiUserCapacity(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_KPI_LIST");
|
||||
const kpiUserCapacity = await this.kpiUserCapacityRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -253,8 +259,9 @@ export class KpiUserCapacityController extends Controller {
|
|||
@Post("point")
|
||||
async CreateKpiUserCapacityPoint(
|
||||
@Body() requestBody: KpiUserCapacityDataPoint[],
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_KPI_LIST");
|
||||
for (const item of requestBody) {
|
||||
const kpiUserCapacity = await this.kpiUserCapacityRepository.findOne({
|
||||
where: { id: item.id },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue