log
This commit is contained in:
parent
f9fce4ba25
commit
8e0de97b78
21 changed files with 637 additions and 210 deletions
|
|
@ -39,6 +39,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")
|
||||
|
|
@ -249,27 +250,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")
|
||||
|
|
@ -400,13 +401,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",
|
||||
|
|
@ -532,7 +535,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);
|
||||
}
|
||||
|
|
@ -548,7 +553,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 },
|
||||
|
|
@ -559,10 +564,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);
|
||||
}
|
||||
|
||||
|
|
@ -577,7 +586,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 },
|
||||
|
|
@ -604,10 +613,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);
|
||||
}
|
||||
|
||||
|
|
@ -622,7 +633,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 },
|
||||
|
|
@ -643,11 +654,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);
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +674,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 },
|
||||
|
|
@ -673,10 +685,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);
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +705,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 },
|
||||
|
|
@ -702,10 +716,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);
|
||||
}
|
||||
|
||||
|
|
@ -720,7 +736,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 },
|
||||
|
|
@ -758,10 +774,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);
|
||||
}
|
||||
|
||||
|
|
@ -893,7 +911,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 },
|
||||
});
|
||||
|
|
@ -903,7 +921,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
await this.kpiUserEvalutionRepository.remove(kpiUserEvaluation);
|
||||
await this.kpiUserEvalutionRepository.remove(kpiUserEvaluation, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +934,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;
|
||||
|
|
@ -1000,9 +1018,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();
|
||||
|
|
@ -1017,7 +1037,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;
|
||||
|
|
@ -1081,9 +1101,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();
|
||||
|
|
@ -1098,7 +1120,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;
|
||||
|
|
@ -1159,9 +1181,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();
|
||||
|
|
@ -1173,10 +1197,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 },
|
||||
});
|
||||
|
|
@ -1186,11 +1207,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);
|
||||
}
|
||||
|
||||
|
|
@ -1211,7 +1234,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 },
|
||||
|
|
@ -1252,6 +1275,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 =
|
||||
|
|
@ -1262,7 +1287,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);
|
||||
}
|
||||
|
||||
|
|
@ -1281,7 +1307,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 },
|
||||
|
|
@ -1322,11 +1348,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);
|
||||
}
|
||||
|
||||
|
|
@ -1345,7 +1375,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 },
|
||||
|
|
@ -1370,11 +1400,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);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1425,9 +1459,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 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
@ -1494,10 +1530,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"],
|
||||
|
|
@ -1508,10 +1541,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);
|
||||
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