Skip to content
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

[EDGEPATRON-131]-Added POST edge api for LOC patron #113

Merged
merged 12 commits into from
Jun 10, 2024
Merged

Conversation

SinghAdes
Copy link
Contributor

@SinghAdes SinghAdes commented Jun 5, 2024

https://folio-org.atlassian.net/browse/EDGPATRON-131

Approcah:- Added edge api call for POST endpoint (/patron/account)

import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove wild card imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

import org.folio.edge.patron.model.Account;
import org.folio.edge.patron.model.Charge;
import org.folio.edge.patron.model.Hold;
import org.folio.edge.patron.model.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove wildcards import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -151,6 +153,21 @@ public void handlePlaceItemHold(RoutingContext ctx) {
t -> handleProxyException(ctx, t)));
}

public void handlePatronRequest(RoutingContext ctx) {
if (ctx.body().asJsonObject() == null) {
badRequest(ctx, MSG_HOLD_NOBODY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the error message specific to this api

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

logger.debug("response: " + respBody);
}

String contentType = resp.getHeader(HttpHeaders.CONTENT_TYPE.toString());

if (resp.statusCode() < 400){
if (resp.statusCode() < 400 && Objects.nonNull(respBody)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the use of new condition here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vignesh-kalyanasundaram :- just as precaution , There might be a case when we receive an empty or null response from mod-patron. in this case this code will not fail as NullPointer exception .

Copy link

sonarcloud bot commented Jun 10, 2024

@SinghAdes SinghAdes merged commit 4bc6bac into master Jun 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants