Skip to content

Commit

Permalink
EPMRPP-89396 || EPMRPP-89397 || EPMRPP-89395 || Change batch endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
APiankouski committed Feb 23, 2024
1 parent 5540bd8 commit ecb709f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.epam.ta.reportportal.model.DeleteBulkRQ;
import com.epam.ta.reportportal.model.DeleteBulkRS;
import com.epam.ta.reportportal.ws.model.OperationCompletionRS;
import java.util.List;

/**
* Delete Launch request handler
Expand All @@ -42,7 +43,7 @@ OperationCompletionRS deleteLaunch(Long launchId, ReportPortalUser.ProjectDetail
ReportPortalUser user);

/**
* Bul launches delete.
* Bulk launches delete.
*
* @param deleteBulkRQ {@link DeleteBulkRQ}
* @param projectDetails Project Details
Expand All @@ -51,4 +52,15 @@ OperationCompletionRS deleteLaunch(Long launchId, ReportPortalUser.ProjectDetail
*/
DeleteBulkRS deleteLaunches(DeleteBulkRQ deleteBulkRQ,
ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user);

/**
* Bulk launches delete.
*
* @param ids list of launch ids
* @param projectDetails Project Details
* @param user User
* @return DeleteLaunchesRS
*/
DeleteBulkRS deleteLaunches(List<Long> ids,
ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public OperationCompletionRS deleteUser(@PathVariable(value = "id") Long userId,
@Operation(summary = "Delete specified users by ids (DEPRECATED)")
public DeleteBulkRS deleteUsers(@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
@AuthenticationPrincipal ReportPortalUser user) {
return super.deleteUsers(deleteBulkRQ, user);
return super.deleteUsers(deleteBulkRQ.getIds(), user);
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ public void getLaunchReport(@PathVariable String projectName, @PathVariable Long
@ResponseStatus(OK)
@Operation(summary = "Delete specified launches by ids")
public DeleteBulkRS deleteLaunches(@PathVariable String projectName,
@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
@RequestParam(value = "ids") List<Long> ids,
@AuthenticationPrincipal ReportPortalUser user) {
return deleteLaunchMessageHandler.deleteLaunches(deleteBulkRQ,
return deleteLaunchMessageHandler.deleteLaunches(ids,
projectExtractor.extractProjectDetails(user, normalizeId(projectName)), user
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.security.Principal;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.jooq.Operator;
Expand Down Expand Up @@ -172,9 +173,9 @@ public OperationCompletionRS updateProjectNotificationConfig(@PathVariable Strin
@ResponseStatus(OK)
@PreAuthorize(ADMIN_ONLY)
@Operation(summary = "Delete multiple projects", description = "Could be deleted only by users with administrator role")
public DeleteBulkRS deleteProject(@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
public DeleteBulkRS deleteProject(@RequestParam(value = "ids") List<Long> ids,
@AuthenticationPrincipal ReportPortalUser user) {
return deleteProjectHandler.bulkDeleteProjects(deleteBulkRQ.getIds(), user);
return deleteProjectHandler.bulkDeleteProjects(ids, user);
}

@DeleteMapping("/{projectId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -167,9 +168,9 @@ public OperationCompletionRS deleteUser(@PathVariable(value = "id") Long userId,
@PreAuthorize(ADMIN_ONLY)
@ResponseStatus(OK)
@Operation(summary = "Delete specified users by ids")
public DeleteBulkRS deleteUsers(@RequestBody @Valid DeleteBulkRQ deleteBulkRQ,
public DeleteBulkRS deleteUsers(@RequestParam(value = "ids") List<Long> ids,
@AuthenticationPrincipal ReportPortalUser user) {
return deleteUserHandler.deleteUsers(deleteBulkRQ.getIds(), user);
return deleteUserHandler.deleteUsers(ids, user);
}

@Transactional
Expand Down

0 comments on commit ecb709f

Please sign in to comment.