Skip to content

Commit

Permalink
Merge pull request #841 from DataVault/DS-admin-review-fix-20241105
Browse files Browse the repository at this point in the history
Fix /admin/review
  • Loading branch information
dspeed2 authored Nov 6, 2024
2 parents eb00319 + c7c0ace commit 8a89020
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public List<DepositReview> getDepositReviews(@RequestHeader(HEADER_USER_ID) Stri
}

@ApiMethod(
path = "/vaultreviews/depositreviews/{depositReviewId}",
path = "/vaultreviews/depositreviews/{depositId}",
verb = ApiVerb.GET,
description = "Gets a particular Deposit Review",
produces = { MediaType.APPLICATION_JSON_VALUE },
Expand All @@ -138,11 +138,11 @@ public List<DepositReview> getDepositReviews(@RequestHeader(HEADER_USER_ID) Stri
@ApiHeaders(headers={
@ApiHeader(name=HEADER_USER_ID, description="DataVault Broker User ID")
})
@GetMapping("/vaultreviews/depositreviews/{depositReviewId}")
@GetMapping("/vaultreviews/depositreviews/{depositId}")
public DepositReview getDepositReview(@RequestHeader(HEADER_USER_ID) String userID,
@PathVariable("depositReviewId") String depositReviewId) {
@PathVariable("depositId") String depositId) {

DepositReview depositReview = depositsReviewService.getDepositReview(depositReviewId);
DepositReview depositReview = depositsReviewService.getDepositReview(depositId);
return depositReview;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public List<DepositReview> getDepositReviews() {
return depositReviewDAO.list();
}

public DepositReview getDepositReview(String depositReviewID) {
return depositReviewDAO.findById(depositReviewID).orElse(null);
public DepositReview getDepositReview(String depositID) {
return depositReviewDAO.findByDepositId(depositID).orElse(null);
}

public List<DepositReview> search(String query) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public class ReviewsControllerAuthTest extends BaseControllerAuthTest {
@Test
void testGetDepositReview() {

when(controller.getDepositReview(USER_ID_1, "deposit-review-123")).thenReturn(
when(controller.getDepositReview(USER_ID_1, "deposit-123")).thenReturn(
AuthTestData.DEPOSIT_REVIEW_1);

checkWorksWhenAuthenticatedFailsOtherwise(
get("/vaultreviews/depositreviews/{depositReviewId}", "deposit-review-123"),
get("/vaultreviews/depositreviews/{depositId}", "deposit-123"),
AuthTestData.DEPOSIT_REVIEW_1);

verify(controller).getDepositReview(USER_ID_1, "deposit-review-123");
verify(controller).getDepositReview(USER_ID_1, "deposit-123");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public interface DepositReviewDAO extends BaseDAO<DepositReview>, DepositReviewC
@EntityGraph(DepositReview.EG_DEPOSIT_REVIEW)
Optional<DepositReview> findById(String id);

@EntityGraph(DepositReview.EG_DEPOSIT_REVIEW)
Optional<DepositReview> findByDepositId(String depositId);

@Override
@EntityGraph(DepositReview.EG_DEPOSIT_REVIEW)
List<DepositReview> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public String showReview(ModelMap model,

List<DepositReviewModel> depositReviewModels = new ArrayList<>();
for (int i = 0; i < reviewInfo.getDepositIds().size(); i++) {
String reviewId = reviewInfo.getDepositIds().get(i);
DepositInfo depositInfo = restService.getDeposit(reviewId);
DepositReview depositReview = restService.getDepositReview(reviewId);
String depositId = reviewInfo.getDepositIds().get(i);
DepositInfo depositInfo = restService.getDeposit(depositId);
DepositReview depositReview = restService.getDepositReview(depositId);
DepositReviewModel drm = new DepositReviewModel();

// Set DepositReview stuff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ public VaultReview getVaultReview(String vaultReviewId) {
return response.getBody();
}

public DepositReview getDepositReview(String depositReviewId) {
ResponseEntity<DepositReview> response = get(brokerURL +"/vaultreviews/depositreviews/" + depositReviewId, DepositReview.class);
public DepositReview getDepositReview(String depositId) {
ResponseEntity<DepositReview> response = get(brokerURL +"/vaultreviews/depositreviews/" + depositId, DepositReview.class);
return response.getBody();
}

Expand Down

0 comments on commit 8a89020

Please sign in to comment.