Skip to content

Commit 2460910

Browse files
authored
Delete multiple calculation result. (#131)
Signed-off-by: AAJELLAL <[email protected]>
1 parent de6ff57 commit 2460910

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/main/java/org/gridsuite/shortcircuit/server/ShortCircuitController.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,11 @@ public ResponseEntity<Page<FeederResult>> getPagedFeederResults(@Parameter(descr
114114
: ResponseEntity.notFound().build();
115115
}
116116

117-
@DeleteMapping(value = "/results/{resultUuid}", produces = APPLICATION_JSON_VALUE)
118-
@Operation(summary = "Delete a short circuit analysis result from the database")
119-
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The short circuit analysis result has been deleted")})
120-
public ResponseEntity<Void> deleteResult(@Parameter(description = "Result UUID") @PathVariable("resultUuid") UUID resultUuid) {
121-
shortCircuitService.deleteResult(resultUuid);
122-
return ResponseEntity.ok().build();
123-
}
124-
125117
@DeleteMapping(value = "/results", produces = APPLICATION_JSON_VALUE)
126-
@Operation(summary = "Delete all short circuit analysis results from the database")
118+
@Operation(summary = "Delete short circuit analysis results from the database")
127119
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "All short circuit analysis results have been deleted")})
128-
public ResponseEntity<Void> deleteResults() {
129-
shortCircuitService.deleteResults();
120+
public ResponseEntity<Void> deleteResults(@Parameter(description = "Results UUID") @RequestParam(value = "resultsUuids", required = false) List<UUID> resultsUuids) {
121+
shortCircuitService.deleteResults(resultsUuids);
130122
return ResponseEntity.ok().build();
131123
}
132124

src/test/java/org/gridsuite/shortcircuit/server/ShortCircuitAnalysisControllerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void runTest() throws Exception {
480480
.andExpect(status().isNotFound());
481481

482482
// test one result deletion
483-
mockMvc.perform(delete("/" + VERSION + "/results/{resultUuid}", RESULT_UUID))
483+
mockMvc.perform(delete("/" + VERSION + "/results").queryParam("resultsUuids", RESULT_UUID.toString()))
484484
.andExpect(status().isOk());
485485

486486
mockMvc.perform(get("/" + VERSION + "/results/{resultUuid}", RESULT_UUID))
@@ -886,7 +886,7 @@ void checkShortCircuitLimitsTest() throws Exception {
886886
assertEquals(200.0, resultDto.getFaults().get(0).getShortCircuitLimits().getIpMax(), 0.1);
887887
assertEquals(10.5, resultDto.getFaults().get(1).getShortCircuitLimits().getIpMin(), 0.1);
888888
assertEquals(200.0, resultDto.getFaults().get(1).getShortCircuitLimits().getIpMax(), 0.1);
889-
mockMvc.perform(delete("/" + VERSION + "/results/{resultUuid}", RESULT_UUID))
889+
mockMvc.perform(delete("/" + VERSION + "/results").queryParam("resultsUuids", RESULT_UUID.toString()))
890890
.andExpect(status().isOk());
891891

892892
mockMvc.perform(post(

0 commit comments

Comments
 (0)