-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat(rest): create new endpoint to delete ModerationRequests by id. #2363
base: main
Are you sure you want to change the base?
feat(rest): create new endpoint to delete ModerationRequests by id. #2363
Conversation
96593e6
to
ab23de1
Compare
As discussed on call -> instead of deleting a single MR, input list of ModerationRequest Ids that needs to be deleted from user. |
2a26766
to
cae0564
Compare
@rudra-superrr, As per our discussion user can delete bulk moderation request based on Ids. And also deleting Approved MR as well. |
4d0c45e
to
b1c519b
Compare
726bf96
to
980dd4b
Compare
980dd4b
to
881b2db
Compare
comment addressed. |
45e31e4
to
3608a1e
Compare
Comment Addressed. |
} | ||
} | ||
|
||
public static boolean isOpenModerationRequest(@NotNull ModerationRequest moderationRequest) { |
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.
Remove this method as it is already present in service class.
) | ||
@PreAuthorize("hasAuthority('WRITE')") | ||
@RequestMapping(value = MODERATION_REQUEST_URL + "/delete", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteModerationRequest(HttpServletRequest request, @RequestBody List<String> ids, |
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.
use spaces for indentation instead of tabs.
@@ -49,7 +54,7 @@ public class Sw360ModerationRequestService { | |||
private String thriftServerUrl; | |||
|
|||
public static boolean isOpenModerationRequest(@NotNull ModerationRequest moderationRequest) { | |||
return moderationRequest.getModerationState() == ModerationState.PENDING || moderationRequest.getModerationState() == ModerationState.INPROGRESS; | |||
return moderationRequest.getModerationState() == ModerationState.PENDING || moderationRequest.getModerationState() == ModerationState.INPROGRESS || moderationRequest.getModerationState() == ModerationState.APPROVED; |
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.
why you added approved state in isOpenModerationRequest method? please remove it
@@ -253,4 +265,38 @@ public ModerationState assignRequest(@NotNull ModerationRequest request, @NotNul | |||
getThriftModerationClient().setInProgress(request.getId(), reviewer); | |||
return ModerationState.INPROGRESS; | |||
} | |||
|
|||
public RequestStatus deleteModerationRequestInfo(@NotNull User sw360User, @NotNull String id, @NotNull ModerationRequest moderationRequest, ModerationState moderationState) |
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.
use spaces for indentation instead of tabs.
A `DELETE` method will delete list of moderation request. | ||
|
||
===== Example request | ||
include::{snippets}/should_document_get_moderationrequests_delete/curl-request.adoc[] |
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.
change the method name to should_document_delete_moderationRequests
@@ -494,4 +501,33 @@ public void should_document_get_moderationrequests_submission() throws Exception | |||
subsectionWithPath("_links").description("<<resources-index-links,Links>> to other resources") | |||
))); | |||
} | |||
|
|||
@Test | |||
public void should_document_get_moderationrequests_delete() throws Exception { |
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.
use spaces for indentation instead of tabs
789ca1d
to
15a3606
Compare
15a3606
to
d992913
Compare
d992913
to
0117a2b
Compare
7c3da97
to
6976709
Compare
@nikkuma7 please rebase with latest main |
6976709
to
75d06c3
Compare
Signed-off-by: Nikesh kumar <[email protected]>
75d06c3
to
beee117
Compare
Issue: Closes: #2362
Suggest Reviewer
How To Test?
http://localhost:8080/resource/api/moderationrequest/delete/{id}
Checklist
Must: