feat: test controller student
This commit is contained in:
parent
52364d717c
commit
5490bd6b86
4 changed files with 165 additions and 47 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue