updated api after test connect frontend

This commit is contained in:
Warunee Tamkoo 2024-09-06 14:38:37 +07:00
parent 4b55b8cf20
commit b48df26505
10 changed files with 275 additions and 73 deletions

View file

@ -451,6 +451,7 @@ export class AssignController extends Controller {
lists.map(async (item) => {
const director = await this.assignDirectorRepository.find({
where: { assign_id: item.id },
order: { ordering: "ASC" },
});
let mentors = "";
@ -500,6 +501,7 @@ export class AssignController extends Controller {
"round_no",
"date_start",
"date_finish",
"other_desc",
"other4_desc",
"other5_no1_desc",
"experimenter_dated",
@ -575,12 +577,21 @@ export class AssignController extends Controller {
where: { active: 1 },
});
const laws = await lawData.map((x) => ({
id: x.id,
selected: x.assignLaw ? 1 : 0,
description: x.description,
status_select: x.status_select,
}));
const laws = await Promise.all(
lawData.map(async (x) => {
const assignLaw = await this.assignLawRepository.countBy({
assign_id: assign_id,
law_id: x.id,
});
return {
id: x.id,
selected: assignLaw > 0 ? 1 : 0,
description: x.description,
status_select: x.status_select,
};
}),
);
const skillsData = await this.assignSkillRepository.find({
relations: ["skill"],
@ -640,6 +651,7 @@ export class AssignController extends Controller {
const director = await this.assignDirectorRepository.find({
where: { assign_id },
order: { ordering: "ASC" },
});
let mentors = [];