-
Notifications
You must be signed in to change notification settings - Fork 1
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
BI-2374 Add delete catch-all to deltabreed brapi controller #427
base: main
Are you sure you want to change the base?
Conversation
@@ -178,7 +178,7 @@ private void batchProcessGermplasm(List<BrAPIGermplasm> germplasmList, String pr | |||
Pattern programKeyPattern = Utilities.getRegexPatternMatchAllProgramKeysAnyAccession(programKey); | |||
germplasmList.parallelStream().forEach(germplasm -> { | |||
// Set dbId | |||
germplasm.germplasmDbId(Utilities.getExternalReference(germplasm.getExternalReferences(), "breedinginsight.org") | |||
germplasm.germplasmDbId(Utilities.getExternalReference(germplasm.getExternalReferences(), "breeding-insight.net") |
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.
What was the reason for this change? Should we be using the value defined in application.yml brapi.server.reference-source
@@ -186,6 +187,15 @@ public HttpResponse<?> getCatchall(@PathVariable("path") String path, @PathVaria | |||
return executeRequest(path, programId, request, "GET"); | |||
} | |||
|
|||
@Delete("/${micronaut.bi.api.version}/programs/{programId}" + BrapiVersion.BRAPI_V2 + "/{+path}") | |||
@Produces(MediaType.APPLICATION_JSON) | |||
@ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.PROGRAM_SCOPED_ROLES}) |
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.
Is this something only a program or system admin should be allowed to do? Wondering if we should make a new role group that is system admin and program admin without readonly.
@@ -241,6 +251,22 @@ private HttpResponse<String> executeRequest(String path, UUID programId, HttpReq | |||
throw new HttpStatusException(HttpStatus.UNAUTHORIZED, "Unauthorized BrAPI Request"); | |||
} | |||
|
|||
private HttpResponse<String> executeDeleteRequest(String path, UUID programId, HttpRequest<?> request) { | |||
AuthenticatedUser actingUser = securityService.getUser(); |
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.
actingUser isn't used
@@ -241,6 +251,22 @@ private HttpResponse<String> executeRequest(String path, UUID programId, HttpReq | |||
throw new HttpStatusException(HttpStatus.UNAUTHORIZED, "Unauthorized BrAPI Request"); | |||
} | |||
|
|||
private HttpResponse<String> executeDeleteRequest(String path, UUID programId, HttpRequest<?> request) { | |||
AuthenticatedUser actingUser = securityService.getUser(); | |||
|
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.
Maybe should add a logCall
so behavior is consistent with executeByteRequest and executeRequest
@Delete("/${micronaut.bi.api.version}/programs/{programId}" + BrapiVersion.BRAPI_V2 + "/{+path}") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.PROGRAM_SCOPED_ROLES}) | ||
public HttpResponse<?> deleteCatchall(@PathVariable("path") String path, |
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.
When testing I could do DELETE http://localhost:8081/v1/programs/9d4719fe-bd89-4d54-bbf6-e71f33f87b04/brapi/v2/trials/
with no trialDbId and get success. Seems like it should give an error in that case.
@@ -186,6 +187,15 @@ public HttpResponse<?> getCatchall(@PathVariable("path") String path, @PathVaria | |||
return executeRequest(path, programId, request, "GET"); | |||
} | |||
|
|||
@Delete("/${micronaut.bi.api.version}/programs/{programId}" + BrapiVersion.BRAPI_V2 + "/{+path}") |
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.
When the delete pass through is overridden by specific implementations in future cards, is the plan to use the DeltaBreed external reference id rather than the DbId of the brapi service?
@@ -186,6 +187,15 @@ public HttpResponse<?> getCatchall(@PathVariable("path") String path, @PathVaria | |||
return executeRequest(path, programId, request, "GET"); | |||
} | |||
|
|||
@Delete("/${micronaut.bi.api.version}/programs/{programId}" + BrapiVersion.BRAPI_V2 + "/{+path}") | |||
@Produces(MediaType.APPLICATION_JSON) |
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.
As we discussed in standup, this currently won't delete the associated dataset and that should be captured in the the experiment delete endpoint implementation.
Description
Story: BI-2374
This pull request introduces several changes to the BrAPIV2Controller. Here's a summary of the key modifications:
BrAPIGermplasmController
BrAPIV2Controller
deleteCatchall
method to handle DELETE requests.executeDeleteRequest
method to process DELETE requests.Other Changes
Dependencies
The delete endpoints for the BrAPi Java Test Server, see the PR for delete endpoints
Testing
Same testing as described in PR for delete endpoints
Checklist: