Merge branch 'develop' of github.com:Frappet/bma-ehr-kpi into develop
# Conflicts: # src/controllers/KpiUserEvaluationController.ts
This commit is contained in:
commit
adbdcbf826
1 changed files with 82 additions and 49 deletions
|
|
@ -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";
|
||||
|
|
@ -39,6 +37,7 @@ import { KpiLink } from "../entities/kpiLink";
|
|||
import { KpiGroup } from "../entities/kpiGroup";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/kpi/user/evaluation")
|
||||
@Tags("kpiUserEvaluation")
|
||||
|
|
@ -64,7 +63,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
*/
|
||||
@Post("admin")
|
||||
async listKpiAdminEvaluation(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
|
|
@ -200,8 +199,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคลทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Post("list")
|
||||
async listKpiListEvaluation(
|
||||
@Post("list-announce")
|
||||
async listKpiListEvaluationAnnounce(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
|
|
@ -215,7 +214,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
evaluating?: boolean | null;
|
||||
},
|
||||
) {
|
||||
await new permission().PermissionDelete(request, "SYS_KPI_LIST");
|
||||
await new permission().PermissionDelete(request, "SYS_RESULT");
|
||||
let conditionFullName =
|
||||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
|
|
@ -317,8 +316,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคลทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Post("list-announce")
|
||||
async listKpiListEvaluationAnnounce(
|
||||
@Post("list")
|
||||
async listKpiListEvaluation(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
|
|
@ -332,7 +331,6 @@ export class KpiUserEvaluationController extends Controller {
|
|||
evaluating?: boolean | null;
|
||||
},
|
||||
) {
|
||||
await new permission().PermissionDelete(request, "SYS_RESULT");
|
||||
let conditionFullName =
|
||||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
|
|
@ -518,13 +516,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.posTypeNameEvaluator = x.posTypeName;
|
||||
kpiUserEvaluation.orgEvaluator = x.root;
|
||||
});
|
||||
const before = null;
|
||||
kpiUserEvaluation.evaluationStatus = "NEW";
|
||||
kpiUserEvaluation.evaluationResults = "PENDING";
|
||||
kpiUserEvaluation.createdUserId = request.user.sub;
|
||||
kpiUserEvaluation.createdFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
enum CapacityType {
|
||||
HEAD = "HEAD",
|
||||
|
|
@ -650,7 +650,9 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.weightPoint1 = 50;
|
||||
kpiUserEvaluation.weightPoint2 = 50;
|
||||
}
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
|
@ -666,7 +668,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async updateKpiUserCheckEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserCheckEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -677,10 +679,14 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +701,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async updateKpiUserPointEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserPointEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -722,10 +728,12 @@ export class KpiUserEvaluationController extends Controller {
|
|||
} else {
|
||||
kpiUserEvaluation.evaluationResults = "IMPROVEMENT";
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -740,7 +748,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async updateKpiUserEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -761,11 +769,12 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรอบการประเมินผลการปฏิบัติหน้าที่ราชการนี้",
|
||||
);
|
||||
}
|
||||
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -780,7 +789,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async updateKpiUserReqEditEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserReqEditEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -791,10 +800,12 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.evaluationReqEdit = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -809,7 +820,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async updateKpiUserResultEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserResultEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -820,10 +831,12 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.evaluationResults = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -838,7 +851,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async updateKpiUserStatusEvaluation(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: updateKpiUserStatusEvaluation,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -876,10 +889,12 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.evaluationStatus = requestBody.status.trim().toUpperCase();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -1011,7 +1026,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @param {string} id Guid, *Id รายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiUserEvaluation(@Path() id: string) {
|
||||
async deleteKpiUserEvaluation(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -1021,7 +1036,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
await this.kpiUserEvalutionRepository.remove(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.remove(kpiUserEvaluation, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -1034,7 +1049,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
*/
|
||||
@Post("admin/change-status")
|
||||
async ChangeStatus(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
status: string;
|
||||
|
|
@ -1118,9 +1133,11 @@ export class KpiUserEvaluationController extends Controller {
|
|||
} else {
|
||||
item.evaluationStatus = requestBody.status.trim().toUpperCase();
|
||||
}
|
||||
const before = null;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(item);
|
||||
await this.kpiUserEvalutionRepository.save(item, { data: request });
|
||||
setLogDataDiff(request, { before, after: item });
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -1135,7 +1152,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
*/
|
||||
@Post("admin/req-edit")
|
||||
async RequestEdit(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
status: string;
|
||||
|
|
@ -1199,9 +1216,11 @@ export class KpiUserEvaluationController extends Controller {
|
|||
item.evaluationReqEdit = requestBody.status.trim().toUpperCase();
|
||||
}
|
||||
|
||||
const before = null;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(item);
|
||||
await this.kpiUserEvalutionRepository.save(item, { data: request });
|
||||
setLogDataDiff(request, { before, after: item });
|
||||
});
|
||||
|
||||
return new HttpSuccess();
|
||||
|
|
@ -1216,7 +1235,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
*/
|
||||
@Post("admin/result-status")
|
||||
async ResultStatus(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
status: string;
|
||||
|
|
@ -1277,9 +1296,11 @@ export class KpiUserEvaluationController extends Controller {
|
|||
// } else {
|
||||
// // item.evaluationStatus = requestBody.status.trim().toUpperCase();
|
||||
// }
|
||||
const before = null;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(item);
|
||||
await this.kpiUserEvalutionRepository.save(item, { data: request });
|
||||
setLogDataDiff(request, { before, after: item });
|
||||
});
|
||||
|
||||
return new HttpSuccess();
|
||||
|
|
@ -1291,10 +1312,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Get("open/{id}")
|
||||
async openKpiUserEvaluation(
|
||||
@Path() id: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
async openKpiUserEvaluation(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -1304,11 +1322,13 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.isOpen = true;
|
||||
kpiUserEvaluation.openDate = new Date();
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -1329,7 +1349,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
timeEvaluator?: string | null;
|
||||
reasonEvaluator?: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -1370,6 +1390,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.catch((x) => {});
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER";
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
||||
kpiUserEvaluation.topicEvaluator =
|
||||
requestBody.topicEvaluator == null ? _null : requestBody.topicEvaluator;
|
||||
kpiUserEvaluation.developEvaluator =
|
||||
|
|
@ -1380,7 +1402,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
requestBody.reasonEvaluator == null ? _null : requestBody.reasonEvaluator;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -1399,7 +1422,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isReason: boolean;
|
||||
reason?: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -1440,11 +1463,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.catch((x) => {});
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER_HIGH";
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
||||
kpiUserEvaluation.isReasonCommander = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommander = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
|
|
@ -1463,7 +1490,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
isReason: boolean;
|
||||
reason?: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
|
|
@ -1488,11 +1515,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
|
||||
kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1543,9 +1574,11 @@ export class KpiUserEvaluationController extends Controller {
|
|||
})
|
||||
.then((x) => {})
|
||||
.catch((x) => {});
|
||||
const before = null;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
@ -1612,10 +1645,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Get("summary/{id}")
|
||||
async getSummaryKpiEvaluation(
|
||||
@Path() id: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
async getSummaryKpiEvaluation(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["id", "evaluationStatus", "lastUpdateUserId", "lastUpdateFullName"],
|
||||
|
|
@ -1626,10 +1656,13 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const before = structuredClone(kpiUserEvaluation);
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY";
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation, { data: request });
|
||||
setLogDataDiff(request, { before, after: kpiUserEvaluation });
|
||||
|
||||
return new HttpSuccess(kpiUserEvaluation);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue