update commander

This commit is contained in:
AdisakKanthawilang 2025-04-21 15:48:29 +07:00
parent 38b67ebc38
commit 3d71a22002
3 changed files with 71 additions and 13 deletions

View file

@ -85,19 +85,19 @@ export class EvaluationController {
})
.select([
"evaluation.id",
"evaluation.dateAnnounce",
"evaluation.type",
"evaluation.subject",
"evaluation.evaluationResult",
"evaluation.lastUpdatedAt",
])
.orderBy("evaluation.dateAnnounce", "ASC")
.orderBy("evaluation.lastUpdatedAt", "ASC")
.getMany();
const performance = list.map((item) => ({
id: item.id,
year: item.dateAnnounce?Extension.ToThaiYear(item.dateAnnounce.getFullYear()):null,
year: item.lastUpdatedAt?Extension.ToThaiYear(item.lastUpdatedAt.getFullYear()):null,
type: item.type == "EXPERT" ? "ชำนาญการ" : item.type == "EXPERTISE" ? "เชียวชาญ" : item.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ": null,
subject: item.subject,
subject: item.subject?item.subject[0]:null,
evaluationResult: item.evaluationResult == "PASS" ? "ผ่าน" : item.evaluationResult == "NOTPASS" ? "ไม่ผ่าน" : null,
}));
@ -2091,6 +2091,14 @@ export class EvaluationController {
evaluation.commanderPositionDoc2 = evaluation.commanderPosition;
evaluation.commanderAboveFullnameDoc2 = evaluation.commanderAboveFullname;
evaluation.commanderAbovePositionDoc2 = evaluation.commanderAbovePosition;
evaluation.commanderOrgDoc2 = evaluation.commanderOrg;
evaluation.commanderOrgOldDoc2 = evaluation.commanderOrgOld;
evaluation.commanderPositionOldDoc2 = evaluation.commanderPositionOld;
evaluation.commanderAboveOrgDoc2 = evaluation.commanderAboveOrg;
evaluation.commanderAboveOrgOldDoc2 = evaluation.commanderAboveOrgOld;
evaluation.commanderAbovePositionOldDoc2 = evaluation.commanderAbovePositionOld;
evaluation.datePrepareDoc2 = new Date();
evaluation.lastUpdateUserId = request.user.sub;
evaluation.lastUpdateFullName = request.user.name;
@ -2653,9 +2661,15 @@ export class EvaluationController {
"author",
"subject",
"commanderFullname",
"commanderOrg",
"commanderOrgOld",
"commanderPosition",
"commanderPositionOld",
"commanderAboveFullname",
"commanderAboveOrg",
"commanderAboveOrgOld",
"commanderAbovePosition",
"commanderAbovePositionOld",
],
});
@ -2689,9 +2703,15 @@ export class EvaluationController {
"author",
"subject",
"commanderFullname",
"commanderOrg",
"commanderOrgOld",
"commanderPosition",
"commanderPositionOld",
"commanderAboveFullname",
"commanderAboveOrg",
"commanderAboveOrgOld",
"commanderAbovePosition",
"commanderAbovePositionOld",
],
});
if (!evaluation) {
@ -2722,9 +2742,15 @@ export class EvaluationController {
"subjectDoc2",
"assignedPosition",
"commanderFullnameDoc2",
"commanderOrgDoc2",
"commanderOrgOldDoc2",
"commanderPositionDoc2",
"commanderPositionOldDoc2",
"commanderAboveFullnameDoc2",
"commanderAboveOrgDoc2",
"commanderAboveOrgOldDoc2",
"commanderAbovePositionDoc2",
"commanderAbovePositionOldDoc2",
"evaluationResult",
],
});
@ -2759,9 +2785,15 @@ export class EvaluationController {
"subjectDoc2",
"assignedPosition",
"commanderFullnameDoc2",
"commanderOrgDoc2",
"commanderOrgOldDoc2",
"commanderPositionDoc2",
"commanderPositionOldDoc2",
"commanderAboveFullnameDoc2",
"commanderAboveOrgDoc2",
"commanderAboveOrgOldDoc2",
"commanderAbovePositionDoc2",
"commanderAbovePositionOldDoc2",
"evaluationResult",
],
});
@ -2799,11 +2831,17 @@ export class EvaluationController {
@Body()
body: {
author: string;
subject: string;
subject: string[];
commanderFullname: string;
commanderOrg: string;
commanderOrgOld?: string;
commanderPosition: string;
commanderPositionOld?: string;
commanderAboveFullname: string;
commanderAboveOrg: string;
commanderAboveOrgOld?: string;
commanderAbovePosition: string;
commanderAbovePositionOld?: string;
},
@Request() request: RequestWithUser,
) {
@ -2813,13 +2851,19 @@ export class EvaluationController {
if (!evaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
}
const _null:any = null;
evaluation.author = body.author;
evaluation.subject = body.subject;
evaluation.commanderFullname = body.commanderFullname;
evaluation.commanderOrg = body.commanderOrg;
evaluation.commanderOrgOld = body.commanderOrgOld??_null;
evaluation.commanderPosition = body.commanderPosition;
evaluation.commanderPositionOld = body.commanderPositionOld??_null;
evaluation.commanderAboveFullname = body.commanderAboveFullname;
evaluation.commanderAboveOrg = body.commanderAboveOrg;
evaluation.commanderAboveOrgOld = body.commanderAboveOrgOld??_null;
evaluation.commanderAbovePosition = body.commanderAbovePosition;
evaluation.commanderAbovePositionOld = body.commanderAbovePositionOld??_null;
evaluation.lastUpdateUserId = request.user.sub;
evaluation.lastUpdateFullName = request.user.name;
evaluation.lastUpdatedAt = new Date();
@ -2859,7 +2903,7 @@ export class EvaluationController {
@Body()
body: {
authorDoc2: string;
subjectDoc2: string;
subjectDoc2: string[];
assignedPosition: string;
commanderFullnameDoc2: string;
commanderPositionDoc2: string;
@ -2874,7 +2918,7 @@ export class EvaluationController {
if (!evaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
}
evaluation.authorDoc2 = body.authorDoc2;
evaluation.subjectDoc2 = body.subjectDoc2;
evaluation.assignedPosition = body.assignedPosition;