Merge branch 'develop' into adiDev
This commit is contained in:
commit
71eac974de
1 changed files with 26 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ import HttpStatusCode from "../interfaces/http-status";
|
||||||
import { KpiCapacity } from "../entities/kpiCapacity";
|
import { KpiCapacity } from "../entities/kpiCapacity";
|
||||||
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
import { KpiUserEvaluation } from "../entities/kpiUserEvaluation";
|
||||||
import { KpiUserCapacity, KpiUserCapacityDataPoint} from "../entities/kpiUserCapacity";
|
import { KpiUserCapacity, KpiUserCapacityDataPoint} from "../entities/kpiUserCapacity";
|
||||||
import { Like, In } from "typeorm";
|
import { Like, In, Not } from "typeorm";
|
||||||
import { Double } from "typeorm/browser";
|
import { Double } from "typeorm/browser";
|
||||||
|
|
||||||
@Route("api/v1/kpi/user/capacity")
|
@Route("api/v1/kpi/user/capacity")
|
||||||
|
|
@ -76,6 +76,18 @@ export class KpiUserCapacityController extends Controller {
|
||||||
"ไม่พบข้อมูลรายการสมรรถนะนี้",
|
"ไม่พบข้อมูลรายการสมรรถนะนี้",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const chkRepleat = await this.kpiUserCapacityRepository.find({
|
||||||
|
where: {
|
||||||
|
kpiUserEvaluationId: requestBody.kpiUserEvaluationId,
|
||||||
|
kpiCapacityId: requestBody.kpiCapacityId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(chkRepleat.length > 0){
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่สามารถเพิ่มข้อมูลได้เนื่องจากรายการสมรรถนะซ้ำ",
|
||||||
|
);
|
||||||
|
}
|
||||||
const kpiUserCapacity = Object.assign(new KpiUserCapacity(), requestBody);
|
const kpiUserCapacity = Object.assign(new KpiUserCapacity(), requestBody);
|
||||||
kpiUserCapacity.createdUserId = request.user.sub;
|
kpiUserCapacity.createdUserId = request.user.sub;
|
||||||
kpiUserCapacity.createdFullName = request.user.name;
|
kpiUserCapacity.createdFullName = request.user.name;
|
||||||
|
|
@ -134,6 +146,19 @@ export class KpiUserCapacityController extends Controller {
|
||||||
"ไม่พบข้อมูลองค์ประกอบที่ 2 พฤติกรรมการปฎิบัติราชการ (สมรรถนะ) นี้",
|
"ไม่พบข้อมูลองค์ประกอบที่ 2 พฤติกรรมการปฎิบัติราชการ (สมรรถนะ) นี้",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const chkRepleat = await this.kpiUserCapacityRepository.find({
|
||||||
|
where: {
|
||||||
|
kpiUserEvaluationId: requestBody.kpiUserEvaluationId,
|
||||||
|
kpiCapacityId: requestBody.kpiCapacityId,
|
||||||
|
id: Not(id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(chkRepleat.length > 0){
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่สามารถแก้ไขข้อมูลได้เนื่องจากรายการสมรรถนะซ้ำ",
|
||||||
|
);
|
||||||
|
}
|
||||||
const _kpiUserCapacity = Object.assign(new KpiUserCapacity(), requestBody);
|
const _kpiUserCapacity = Object.assign(new KpiUserCapacity(), requestBody);
|
||||||
kpiUserCapacity.lastUpdateUserId = request.user.sub;
|
kpiUserCapacity.lastUpdateUserId = request.user.sub;
|
||||||
kpiUserCapacity.lastUpdateFullName = request.user.name;
|
kpiUserCapacity.lastUpdateFullName = request.user.name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue