|
|
@@ -95,6 +95,7 @@ public class ApiInscriptionController {
|
|
|
Optional<Questionnaire> existing = repositoryQuestionnaire.findByUuid(uuid);
|
|
|
if (existing.isPresent()) {
|
|
|
existing.get().setIntroduction(q.getIntroduction());
|
|
|
+ existing.get().setOpened(q.isOpened());
|
|
|
repositoryQuestionnaire.save(existing.get());
|
|
|
} else {
|
|
|
repositoryQuestionnaire.save(q);
|
|
|
@@ -104,6 +105,32 @@ public class ApiInscriptionController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/questionnaire/{uuid}/open")
|
|
|
+ void openInscription(@PathVariable String uuid) {
|
|
|
+ if (repository.findByUuid(uuid).size() > 0) {
|
|
|
+ Optional<Questionnaire> existing = repositoryQuestionnaire.findByUuid(uuid);
|
|
|
+ if (existing.isPresent()) {
|
|
|
+ existing.get().setOpened(true);
|
|
|
+ repositoryQuestionnaire.save(existing.get());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Evenement does not exist");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/questionnaire/{uuid}/close")
|
|
|
+ void closeInscription(@PathVariable String uuid) {
|
|
|
+ if (repository.findByUuid(uuid).size() > 0) {
|
|
|
+ Optional<Questionnaire> existing = repositoryQuestionnaire.findByUuid(uuid);
|
|
|
+ if (existing.isPresent()) {
|
|
|
+ existing.get().setOpened(false);
|
|
|
+ repositoryQuestionnaire.save(existing.get());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Evenement does not exist");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/questionnaire/{uuid}/questions")
|
|
|
List<QuestionnaireQuestion> getQuestionnaireQuestions(@PathVariable String uuid) {
|
|
|
List<QuestionnaireQuestion> output = repositoryQuestionnaireQuestion.findByEvtUuid(uuid);
|