Merge branch 'dev' into refactor/linting
This commit is contained in:
commit
f9b59af2fd
22 changed files with 256 additions and 344 deletions
|
@ -48,7 +48,7 @@ export async function getAllQuestionsHandler(req: Request, res: Response): Promi
|
|||
if (!questions) {
|
||||
res.status(404).json({ error: `Questions not found.` });
|
||||
} else {
|
||||
res.json(questions);
|
||||
res.json({ questions: questions });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,12 +76,12 @@ export async function getQuestionAnswersHandler(req: Request, res: Response): Pr
|
|||
return;
|
||||
}
|
||||
|
||||
const answers = getAnswersByQuestion(questionId, full);
|
||||
const answers = await getAnswersByQuestion(questionId, full);
|
||||
|
||||
if (!answers) {
|
||||
res.status(404).json({ error: `Questions not found.` });
|
||||
res.status(404).json({ error: `Questions not found` });
|
||||
} else {
|
||||
res.json(answers);
|
||||
res.json({ answers: answers });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ export async function createQuestionHandler(req: Request, res: Response): Promis
|
|||
const question = await createQuestion(questionDTO);
|
||||
|
||||
if (!question) {
|
||||
res.status(400).json({ error: 'Could not add question' });
|
||||
res.status(400).json({ error: 'Could not create question' });
|
||||
} else {
|
||||
res.json(question);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue