-
Notifications
You must be signed in to change notification settings - Fork 25
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
[CIRC-1932] Implement search-slips endpoint skeleton #1358
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7a72191
CIRC-1932 implement search-slips endpoint skeleton
roman-barannyk bdf53e8
CIRC-1932 fix code smells
roman-barannyk a2164b9
CIRC-1932 merge slips ramls into one
roman-barannyk 99f8016
CIRC-1932 fix raml issue
roman-barannyk 6067809
CIRC-1932 include review comments
roman-barannyk 691425c
CIRC-1932 rename schema example
roman-barannyk 8dcbc16
Merge branch 'master' into CIRC-1932
roman-barannyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#%RAML 1.0 | ||
title: Stuff Slips | ||
version: v0.3 | ||
protocols: [ HTTP, HTTPS ] | ||
baseUri: http://localhost:9130 | ||
|
||
documentation: | ||
- title: API for fetching current staff slips | ||
content: <b>API for staff slips generation</b> | ||
|
||
types: | ||
stuff-slips: !include staff-slips-response.json | ||
|
||
traits: | ||
language: !include raml-util/traits/language.raml | ||
|
||
resourceTypes: | ||
collection-get: !include raml-util/rtypes/collection-get.raml | ||
|
||
/circulation: | ||
/pick-slips: | ||
/{servicePointId}: | ||
type: | ||
collection-get: | ||
exampleCollection: !include examples/staff-slips-response.json | ||
schemaCollection: stuff-slips | ||
/search-slips: | ||
/{servicePointId}: | ||
type: | ||
collection-get: | ||
exampleCollection: !include examples/staff-slips-response.json | ||
schemaCollection: stuff-slips |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/folio/circulation/resources/SearchSlipsResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.folio.circulation.resources; | ||
|
||
import static org.folio.circulation.support.results.Result.ofAsync; | ||
import static org.folio.circulation.support.results.ResultBinding.flatMapResult; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import org.folio.circulation.domain.MultipleRecords; | ||
import org.folio.circulation.domain.Request; | ||
import org.folio.circulation.support.RouteRegistration; | ||
import org.folio.circulation.support.http.server.JsonHttpResponse; | ||
import org.folio.circulation.support.http.server.WebContext; | ||
import org.folio.circulation.support.results.Result; | ||
|
||
import io.vertx.core.http.HttpClient; | ||
import io.vertx.ext.web.Router; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
public class SearchSlipsResource extends SlipsResource { | ||
private static final String SEARCH_SLIPS_KEY = "searchSlips"; | ||
private final String rootPath; | ||
|
||
public SearchSlipsResource(String rootPath, HttpClient client) { | ||
super(client); | ||
this.rootPath = rootPath; | ||
} | ||
|
||
@Override | ||
public void register(Router router) { | ||
RouteRegistration routeRegistration = new RouteRegistration(rootPath, router); | ||
routeRegistration.getMany(this::getMany); | ||
} | ||
|
||
protected void getMany(RoutingContext routingContext) { | ||
final WebContext context = new WebContext(routingContext); | ||
|
||
fetchHoldRequests() | ||
.thenApply(flatMapResult(requests -> mapResultToJson(requests, SEARCH_SLIPS_KEY))) | ||
.thenApply(r -> r.map(JsonHttpResponse::ok)) | ||
.thenAccept(context::writeResultToHttpResponse); | ||
} | ||
|
||
private CompletableFuture<Result<MultipleRecords<Request>>> fetchHoldRequests() { | ||
return ofAsync(MultipleRecords.empty()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This collection name can be an instance variable injected via constructor