Skip to content

Commit 8d7eec1

Browse files
committed
feat: change raw responses urls and status
1 parent 71f3429 commit 8d7eec1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/fr/insee/genesis/controller/rest/responses/RawResponseController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public ResponseEntity<String> saveRawResponsesFromJsonBodyWithValidationDeprecat
148148

149149
@Operation(summary = "Save lunatic json data from one interrogation in Genesis Database (with json " +
150150
"schema validation)")
151-
@PostMapping(path="/raw-responses")
151+
@PostMapping(path="/raw-responses/debug")
152152
@PreAuthorize("hasRole('COLLECT_PLATFORM')")
153153
public ResponseEntity<String> saveRawResponsesFromJsonBodyWithValidation(
154154
@RequestBody Map<String, Object> body
@@ -172,18 +172,18 @@ public ResponseEntity<String> saveRawResponsesFromJsonBodyWithValidation(
172172
} catch (SchemaValidationException | IOException e) {
173173
return ResponseEntity.status(400).body(e.toString());
174174
}
175-
return ResponseEntity.ok("Change this when ready");
175+
return ResponseEntity.status(201).body(String.format(SUCCESS_MESSAGE, body.get(INTERROGATION_ID).toString()));
176176
}
177177

178178
@Operation(summary = "Save lunatic json data from one interrogation in Genesis Database (with json " +
179179
"schema validation)")
180-
@PostMapping(path="/raw-responses/dto")
180+
@PostMapping(path="/raw-responses")
181181
@PreAuthorize("hasRole('COLLECT_PLATFORM')")
182182
public ResponseEntity<String> saveRawResponsesFromRawResponseDto(
183183
@Valid @RequestBody RawResponseDto dto
184184
) {
185185
rawRepository.saveAsRawJson(dto);
186-
return ResponseEntity.ok("Change this when ready");
186+
return ResponseEntity.status(201).body(String.format(SUCCESS_MESSAGE, dto.getInterrogationId()));
187187
}
188188

189189
//GET unprocessed

0 commit comments

Comments
 (0)