feat: test controller student

This commit is contained in:
Gabriellvl 2025-03-24 11:36:05 +01:00
parent 52364d717c
commit 5490bd6b86
4 changed files with 165 additions and 47 deletions

View file

@ -141,6 +141,7 @@ export async function getStudentSubmissionsHandler(req: Request, res: Response):
}
export async function getStudentQuestionsHandler(req: Request, res: Response): Promise<void> {
const full = req.query.full === 'true';
const username = req.params.username;
if (!username) {

View file

@ -138,8 +138,10 @@ export async function getStudentQuestions(username: string, full: boolean): Prom
const questionRepository = getQuestionRepository();
const questions = await questionRepository.findAllByAuthor(student);
if (full)
return questions.map(mapToQuestionDTO)
const questionsDTO = questions.map(mapToQuestionDTO);
return questions.map(mapToQuestionId);
if (full)
return questionsDTO;
return questionsDTO.map(mapToQuestionId);
}