Skip to content

Commit

Permalink
feat: add endpoint to retrieve questionnaire data directly (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
davdarras authored Apr 30, 2024
1 parent 049ac00 commit 4bc676e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<description>Modules for queen back-office</description>

<properties>
<revision>4.2.11</revision>
<revision>4.2.12</revision>
<changelist></changelist>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.insee.queen.application.campaign.controller;

import com.fasterxml.jackson.databind.node.ObjectNode;
import fr.insee.queen.application.campaign.dto.input.QuestionnaireModelCreationData;
import fr.insee.queen.application.campaign.dto.output.QuestionnaireModelIdDto;
import fr.insee.queen.application.campaign.dto.output.QuestionnaireModelValueDto;
Expand Down Expand Up @@ -55,6 +56,7 @@ public List<QuestionnaireModelValueDto> getQuestionnaireDatasByCampaignId(
}

/**
* @deprecated
* Retrieve the data structure of a questionnaire
*
* @param questionnaireModelId the id of questionnaire
Expand All @@ -63,8 +65,22 @@ public List<QuestionnaireModelValueDto> getQuestionnaireDatasByCampaignId(
@Operation(summary = "Get questionnnaire")
@GetMapping(path = "/questionnaire/{id}")
@PreAuthorize(AuthorityPrivileges.HAS_USER_PRIVILEGES)
public QuestionnaireModelValueDto getQuestionnaireData(@IdValid @PathVariable(value = "id") String questionnaireModelId) {
return new QuestionnaireModelValueDto(questionnaireModelService.getQuestionnaireData(questionnaireModelId));
@Deprecated(since = "4.2.12")
public QuestionnaireModelValueDto getQuestionnaireValue(@IdValid @PathVariable(value = "id") String questionnaireModelId) {
return new QuestionnaireModelValueDto(getQuestionnaireData(questionnaireModelId));
}

/**
* Retrieve the data structure of a questionnaire
*
* @param questionnaireModelId the id of questionnaire
* @return the data linked to the questionnaire
*/
@Operation(summary = "Get questionnnaire data")
@GetMapping(path = "/questionnaire/{id}/data")
@PreAuthorize(AuthorityPrivileges.HAS_USER_PRIVILEGES)
public ObjectNode getQuestionnaireData(@IdValid @PathVariable(value = "id") String questionnaireModelId) {
return questionnaireModelService.getQuestionnaireData(questionnaireModelId);
}

/**
Expand Down

0 comments on commit 4bc676e

Please sign in to comment.