-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GridDyna] Add some batch CRUD endpoints #111
[GridDyna] Add some batch CRUD endpoints #111
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not finished, not tested yet.
src/main/java/org/gridsuite/filter/server/FilterController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/filter/server/FilterController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/filter/server/FilterController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/filter/server/FilterController.java
Outdated
Show resolved
Hide resolved
@PostMapping(value = "/filters", params = "duplicateFrom") | ||
@Operation(summary = "Duplicate a filter") | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The filter has been successfully created"), | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The uuid of the new filter has been successfully duplicated"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The uuid of the new filter has been successfully duplicated"), | |
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The filter with uuid filterId has been successfully duplicated"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I have a slight change from your suggestion to "The filter with given id has been successfully duplicated"
@@ -85,8 +95,19 @@ public ResponseEntity<UUID> duplicateFilter(@RequestParam("duplicateFrom") UUID | |||
.orElse(ResponseEntity.notFound().build()); | |||
} | |||
|
|||
@PostMapping(value = "/filters/batch/duplicate") | |||
@Operation(summary = "Duplicate filters from provided uuids") | |||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The map of sourceUuid and newUuid of duplicated filters"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The map of sourceUuid and newUuid of duplicated filters"), | |
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Filters have been successfully duplicated."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I have a slight change from your suggestion to "Filters of given ids have been successfully duplicated"
@@ -205,13 +219,70 @@ public <F extends AbstractFilter> void changeFilter(UUID id, F newFilter, String | |||
notificationService.emitElementUpdated(id, userId); | |||
} | |||
|
|||
@Transactional | |||
public List<AbstractFilter> changeFilters(Map<UUID, AbstractFilter> filtersToModifyMap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public List<AbstractFilter> changeFilters(Map<UUID, AbstractFilter> filtersToModifyMap) { | |
public List<AbstractFilter> updateFilters(Map<UUID, AbstractFilter> filtersToModifyMap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is quite complicated. As we can assume only few filters will be updated at one time, you can iterate on filtersToModifyMap and call changeFilter.
And rename changeFilter to updateFilter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 0e8609f
@@ -85,18 +95,38 @@ public ResponseEntity<UUID> duplicateFilter(@RequestParam("duplicateFrom") UUID | |||
.orElse(ResponseEntity.notFound().build()); | |||
} | |||
|
|||
@PostMapping(value = "/filters/batch/duplicate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding duplicate
looks like a good way to differentiate the two /filters/batch
but I don't get the fact that this has not be done for the 2 @PostMapping(value = "/filters")
(the creation and the duplication have the same path).
Our rest API best practices are not very precise about extra data like this. But they state that the path should only be used to identify a data.
@etiennehomer shouldn't we modify the filters duplication signature in an other PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add "duplicate" in the path of duplicate endpoint, i.e. POST /filters/duplicate but we have to changer also in gridexplorer-app. I think we can change in another TS
In fact we should have :
POST /filters
POST /filters/batch
POST /filters/duplicate
POST /filters/duplicate/batch
At least I can change from /filters/batch/duplicate to /filters/duplicate/batch, what do you think??? @etiennehomer @Mathieu-Deharbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think the API you propose is good Thang. So let's change POST /filters/batch/duplicate to POST /filters/duplicate/batch
And then, in another PR, let's change for unitary duplication endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE in 0713dfc
...rg/gridsuite/filter/server/repositories/proxies/expertfiler/ExpertFilterRepositoryProxy.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/filter/server/FilterEntityControllerTest.java
Show resolved
Hide resolved
src/test/java/org/gridsuite/filter/server/FilterEntityControllerTest.java
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
Read through it nothing stands out as blocking |
nitpick: /batch endpoints do we have endpoints like this in other parts of the code ? |
NO, I use /batch to distinguish two endpoints 'single' and 'batch' processing for the same HTTP verb POST |
Related PRs:
#111
gridsuite/dynamic-simulation-server#95
gridsuite/dynamic-mapping-server#96
PR powsybl-dynawo:
https://github.com/powsybl/powsybl-dynawo/pull/349 (released 2.5.0-alpha-1)