updated api after test connect frontend
This commit is contained in:
parent
4b55b8cf20
commit
b48df26505
10 changed files with 275 additions and 73 deletions
|
|
@ -90,29 +90,70 @@ export class EvaluateChairmanController extends Controller {
|
|||
|
||||
const directorData = await this.assignDirectorRepository.find({
|
||||
where: { assign_id },
|
||||
order: { ordering: "ASC" },
|
||||
});
|
||||
|
||||
if (!directorData) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
}
|
||||
|
||||
let mentors = "";
|
||||
let mentors = [];
|
||||
const mentorList = await directorData.filter((x) => x.role == "mentor");
|
||||
if (mentorList.length > 0) {
|
||||
for (let index = 0; index < mentorList.length; index++) {
|
||||
const e = await mentorList[index];
|
||||
mentors += e.fullname;
|
||||
if (index < mentorList.length - 1) {
|
||||
mentors += ", ";
|
||||
}
|
||||
|
||||
mentors.push({
|
||||
personal_id: e.personal_id,
|
||||
dated: e.dated,
|
||||
name: e.fullname,
|
||||
label:
|
||||
e.fullname + " " + (e.position ? `(${e.position}, ${e.posType}: ${e.posLevel})` : ""),
|
||||
position: e.position,
|
||||
posType: e.posType,
|
||||
posLevel: e.posLevel,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const commanderData = await (directorData.find((x) => x.role == "commander") ?? null);
|
||||
const commander = commanderData ? commanderData.fullname : null;
|
||||
|
||||
const commander =
|
||||
commanderData != null
|
||||
? {
|
||||
personal_id: commanderData.personal_id,
|
||||
dated: commanderData.dated,
|
||||
name: commanderData.fullname,
|
||||
label:
|
||||
commanderData.fullname +
|
||||
" " +
|
||||
(commanderData.position
|
||||
? `(${commanderData.position}, ${commanderData.posType}: ${commanderData.posLevel})`
|
||||
: ""),
|
||||
position: commanderData.position,
|
||||
posType: commanderData.posType,
|
||||
posLevel: commanderData.posLevel,
|
||||
}
|
||||
: null;
|
||||
|
||||
const chairmanData = await (directorData.find((x) => x.role == "chairman") ?? null);
|
||||
const chairman = chairmanData ? chairmanData.fullname : null;
|
||||
const chairman =
|
||||
chairmanData != null
|
||||
? {
|
||||
personal_id: chairmanData.personal_id,
|
||||
dated: chairmanData.dated,
|
||||
name: chairmanData.fullname,
|
||||
label:
|
||||
chairmanData.fullname +
|
||||
" " +
|
||||
(chairmanData.position
|
||||
? `(${chairmanData.position}, ${chairmanData.posType}: ${chairmanData.posLevel})`
|
||||
: ""),
|
||||
position: chairmanData.position,
|
||||
posType: chairmanData.posType,
|
||||
posLevel: chairmanData.posLevel,
|
||||
}
|
||||
: null;
|
||||
|
||||
return new HttpSuccess({
|
||||
person: profile ? profile : null,
|
||||
|
|
@ -156,12 +197,18 @@ export class EvaluateChairmanController extends Controller {
|
|||
},
|
||||
});
|
||||
} else {
|
||||
evaluate = await this.evaluateChairmanRepository.findOne({
|
||||
evaluate = await this.evaluateChairmanRepository.find({
|
||||
where: {
|
||||
director_id,
|
||||
assign_id,
|
||||
},
|
||||
});
|
||||
|
||||
if (evaluate)
|
||||
evaluate = await evaluate.map((element: EvaluateChairman) => ({
|
||||
...element,
|
||||
no: Number(element.no),
|
||||
}));
|
||||
}
|
||||
|
||||
if (!evaluate) {
|
||||
|
|
@ -196,29 +243,70 @@ export class EvaluateChairmanController extends Controller {
|
|||
|
||||
const directorData = await this.assignDirectorRepository.find({
|
||||
where: { assign_id },
|
||||
order: { ordering: "ASC" },
|
||||
});
|
||||
|
||||
if (!directorData) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล ผู้บังคับบัญชาและประธาน");
|
||||
}
|
||||
|
||||
let mentors = "";
|
||||
let mentors = [];
|
||||
const mentorList = await directorData.filter((x) => x.role == "mentor");
|
||||
if (mentorList.length > 0) {
|
||||
for (let index = 0; index < mentorList.length; index++) {
|
||||
const e = await mentorList[index];
|
||||
mentors += e.fullname;
|
||||
if (index < mentorList.length - 1) {
|
||||
mentors += ", ";
|
||||
}
|
||||
|
||||
mentors.push({
|
||||
personal_id: e.personal_id,
|
||||
dated: e.dated,
|
||||
name: e.fullname,
|
||||
label:
|
||||
e.fullname + " " + (e.position ? `(${e.position}, ${e.posType}: ${e.posLevel})` : ""),
|
||||
position: e.position,
|
||||
posType: e.posType,
|
||||
posLevel: e.posLevel,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const commanderData = await (directorData.find((x) => x.role == "commander") ?? null);
|
||||
const commander = commanderData ? commanderData.fullname : null;
|
||||
|
||||
const commander =
|
||||
commanderData != null
|
||||
? {
|
||||
personal_id: commanderData.personal_id,
|
||||
dated: commanderData.dated,
|
||||
name: commanderData.fullname,
|
||||
label:
|
||||
commanderData.fullname +
|
||||
" " +
|
||||
(commanderData.position
|
||||
? `(${commanderData.position}, ${commanderData.posType}: ${commanderData.posLevel})`
|
||||
: ""),
|
||||
position: commanderData.position,
|
||||
posType: commanderData.posType,
|
||||
posLevel: commanderData.posLevel,
|
||||
}
|
||||
: null;
|
||||
|
||||
const chairmanData = await (directorData.find((x) => x.role == "chairman") ?? null);
|
||||
const chairman = chairmanData ? chairmanData.fullname : null;
|
||||
const chairman =
|
||||
chairmanData != null
|
||||
? {
|
||||
personal_id: chairmanData.personal_id,
|
||||
dated: chairmanData.dated,
|
||||
name: chairmanData.fullname,
|
||||
label:
|
||||
chairmanData.fullname +
|
||||
" " +
|
||||
(chairmanData.position
|
||||
? `(${chairmanData.position}, ${chairmanData.posType}: ${chairmanData.posLevel})`
|
||||
: ""),
|
||||
position: chairmanData.position,
|
||||
posType: chairmanData.posType,
|
||||
posLevel: chairmanData.posLevel,
|
||||
}
|
||||
: null;
|
||||
|
||||
return new HttpSuccess({
|
||||
experimentee: experimentee,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue