Skip to content
Snippets Groups Projects
Commit 77da211d authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Merge branch 'fixCSVEXport' into 'master'

add bulk save method for questions (for importing via csv)

This merge request adds a bulk save function for questions. For now, it's only used for the question import via csv to not save every single question with a seperate request.

See merge request !19
parents 9f571c2b 38e08774
......@@ -90,6 +90,21 @@ public class LecturerQuestionController extends PaginationController {
throw new BadRequestException();
}
@ApiOperation(value = "Post provided questions", nickname = "bulkPostQuestions")
@ApiResponses(value = {
@ApiResponse(code = 400, message = HTML_STATUS_400)
})
@RequestMapping(value = "/bulk", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public List<Question> bulkPostQuestions(@RequestBody final List<Question> questions) {
for (final Question question : questions) {
if (questionService.saveQuestion(question) == null) {
throw new BadRequestException();
}
}
return questions;
}
@ApiOperation(value = "Update the question, identified by provided id, with the provided question in the Request Body",
nickname = "updateQuestion")
@ApiResponses(value = {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment