add api performance/user
This commit is contained in:
parent
bb4634acf5
commit
880ba36978
1 changed files with 44 additions and 1 deletions
|
|
@ -27,7 +27,7 @@ import { Assessment } from "../entities/Assessment";
|
|||
import { Director } from "../entities/Director";
|
||||
import { Meeting } from "../entities/Meeting";
|
||||
import { ConvertThaiToType, ConvertToThaiStep, ConvertToThaiType } from "../services/storage";
|
||||
import { Brackets } from "typeorm";
|
||||
import { Brackets, In } from "typeorm";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
|
|
@ -66,6 +66,41 @@ export class EvaluationController {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายการผลงานที่เคยเสนอขอประเมิน
|
||||
*
|
||||
* @summary รายการผลงานที่เคยเสนอขอประเมิน
|
||||
*
|
||||
*/
|
||||
@Get("performance/user")
|
||||
async listPerformance(@Request() request: RequestWithUser) {
|
||||
const list = await AppDataSource.getRepository(Evaluation)
|
||||
.createQueryBuilder("evaluation")
|
||||
.where("evaluation.userId = :userId", { userId: request.user.sub })
|
||||
.andWhere("evaluation.step = :step", { step: "DONE" })
|
||||
.andWhere("evaluation.evaluationResult IN (:...evaluationResult)", {
|
||||
evaluationResult: ["PASS", "NOTPASS"],
|
||||
})
|
||||
.select([
|
||||
"evaluation.id",
|
||||
"evaluation.dateAnnounce",
|
||||
"evaluation.type",
|
||||
"evaluation.subject",
|
||||
"evaluation.evaluationResult",
|
||||
])
|
||||
.getMany();
|
||||
|
||||
const performance = list.map((item) => ({
|
||||
id: item.id,
|
||||
year: item.dateAnnounce?Extension.ToThaiYear(item.dateAnnounce.getFullYear()):null,
|
||||
type: item.type == "EXPERT" ? "ชำนาญการ" : item.type == "EXPERTISE" ? "เชียวชาญ" : item.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ":null,
|
||||
subject: item.subject,
|
||||
evaluationResult: item.evaluationResult,
|
||||
}));
|
||||
|
||||
return new HttpSuccess(performance);
|
||||
}
|
||||
|
||||
/**
|
||||
* ดึงข้อมูลรายการร้องขอการประเมิน
|
||||
*
|
||||
|
|
@ -1293,6 +1328,7 @@ export class EvaluationController {
|
|||
.leftJoin("evaluation.salaries", "salaries")
|
||||
.leftJoin("evaluation.training", "training")
|
||||
.leftJoin("evaluation.assessment", "assessment")
|
||||
.leftJoin("evaluation.portfolios", "portfolios")
|
||||
.where("evaluation.id = :id", { id })
|
||||
.select([
|
||||
"evaluation.isEducationalQft",
|
||||
|
|
@ -1393,6 +1429,9 @@ export class EvaluationController {
|
|||
"assessment.point2",
|
||||
"assessment.pointSumTotal",
|
||||
"assessment.pointSum",
|
||||
|
||||
"portfolios.name",
|
||||
"portfolios.detail",
|
||||
])
|
||||
.orderBy("salaries.commandDateAffect", "DESC")
|
||||
.getOne();
|
||||
|
|
@ -1504,6 +1543,10 @@ export class EvaluationController {
|
|||
pointSumTotal: assessment.pointSumTotal,
|
||||
pointSum: assessment.pointSum,
|
||||
})),
|
||||
portfolios: evaluation.portfolios.map((portfolio) => ({
|
||||
name: portfolio.name,
|
||||
detail: portfolio.detail,
|
||||
})),
|
||||
};
|
||||
|
||||
if (!dataEvaluation) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue