feat: teacher-class en teacher-students route
This commit is contained in:
parent
6b87722469
commit
9c9e7c4870
6 changed files with 146 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
import { Request, Response } from 'express';
|
||||
import { getAllClasses, getClass, getClassStudents } from '../services/class';
|
||||
import {getAllClasses, getClass, getClassStudents, getClassStudentsIds} from '../services/class';
|
||||
import { ClassDTO } from '../interfaces/classes';
|
||||
|
||||
export async function getAllClassesHandler(
|
||||
|
@ -48,9 +48,12 @@ export async function getClassStudentsHandler(
|
|||
const classId = req.params.id;
|
||||
const full = req.query.full === "true";
|
||||
|
||||
const students = await getClassStudents(classId, full);
|
||||
let students;
|
||||
|
||||
if (full) students = await getClassStudents(classId);
|
||||
else students = await getClassStudentsIds(classId);
|
||||
|
||||
res.json({
|
||||
students: students,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue