Skip to content

Commit

Permalink
Change API Rest naming
Browse files Browse the repository at this point in the history
Signed-off-by: Franck LECUYER <[email protected]>
  • Loading branch information
FranckLecuyer committed Aug 1, 2024
1 parent 00df939 commit b947b94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ public ResponseEntity<List<ModificationMetadata>> getModificationsMetadata(@Requ
return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(networkModificationService.getModificationsMetadata(ids));
}

@PutMapping(value = "/network-modifications/uuids", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@PutMapping(value = "/networks/{networkUuid}/apply", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Apply a list of composite network modifications uuids passed in body")
@ApiResponse(responseCode = "200", description = "The composite modifications have been applied")
public ResponseEntity<Optional<NetworkModificationResult>> applyCompositeModificationsFromUuids(@Parameter(description = "the network uuid", required = true) @RequestParam(value = "networkUuid") UUID networkUuid,
@Parameter(description = "the variant id", required = true) @RequestParam(value = "variantId") String variantId,
@Parameter(description = "the report uuid") @RequestParam(value = "reportUuid", required = false) UUID reportUuid,
@Parameter(description = "the reporter id") @RequestParam(value = "reporterId", required = false) String reporterId,
@RequestBody List<UUID> modificationsUuidList) {
return ResponseEntity.ok().body(networkModificationService.applyCompositeModificationsFromUuids(networkUuid, variantId, new ReportInfos(reportUuid, reporterId), modificationsUuidList));
public ResponseEntity<Optional<NetworkModificationResult>> applyModifications(@Parameter(description = "Network UUID") @PathVariable("networkUuid") UUID networkUuid,
@Parameter(description = "the variant id", required = true) @RequestParam(value = "variantId") String variantId,
@Parameter(description = "the report uuid") @RequestParam(value = "reportUuid", required = false) UUID reportUuid,
@Parameter(description = "the reporter id") @RequestParam(value = "reporterId", required = false) String reporterId,
@RequestBody List<UUID> modificationsUuidList) {
return ResponseEntity.ok().body(networkModificationService.applyModificationsFromUuids(networkUuid, variantId, new ReportInfos(reportUuid, reporterId), modificationsUuidList));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ public List<ModificationMetadata> getModificationsMetadata(List<UUID> ids) {
}

@Transactional
public Optional<NetworkModificationResult> applyCompositeModificationsFromUuids(UUID networkUuid,
String variantId,
ReportInfos reportInfos,
List<UUID> modificationsUuids) {
public Optional<NetworkModificationResult> applyModificationsFromUuids(UUID networkUuid,
String variantId,
ReportInfos reportInfos,
List<UUID> modificationsUuids) {
List<ModificationInfos> modificationInfos = networkModificationRepository.getCompositeModificationsInfos(modificationsUuids);
return applyModifications(networkUuid, variantId, reportInfos, modificationInfos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1605,9 +1605,8 @@ public void testApplyModificationsFromUuids() throws Exception {

// apply the modification on the network
mvcResult = mockMvc.perform(
put("/v1/network-modifications/uuids"
+ "?networkUuid=" + TEST_NETWORK_ID
+ "&variantId=" + NetworkCreation.VARIANT_ID)
put("/v1/networks/" + TEST_NETWORK_ID + "/apply"
+ "?variantId=" + NetworkCreation.VARIANT_ID)
.content(objectWriter.writeValueAsString(modificationUuidList))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andReturn();
Expand Down

0 comments on commit b947b94

Please sign in to comment.