-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MODORDSTOR-364] Create routing_list table and API for it (#390)
* [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it * Fix failing unit tests * [MODORDSTOR-364] Create routing_list table and API for it * [MODORDSTOR-364] Create routing_list table and API for it
- Loading branch information
1 parent
e8745d9
commit 35d67ce
Showing
10 changed files
with
248 additions
and
5 deletions.
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 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,82 @@ | ||
#%RAML 1.0 | ||
title: "mod-orders-storage" | ||
baseUri: http://github.com/folio-org/mod-orders-storage | ||
version: v1.0 | ||
|
||
documentation: | ||
- title: Routing List | ||
content: <b>This module implements the CRUD interface for Routing Lists. </b> | ||
|
||
types: | ||
routing-list: !include acq-models/mod-orders-storage/schemas/routing_list.json | ||
routing-list-collection: !include acq-models/mod-orders-storage/schemas/routing_list_collection.json | ||
error: !include raml-util/schemas/error.schema | ||
errors: !include raml-util/schemas/errors.schema | ||
UUID: | ||
type: string | ||
pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ | ||
|
||
traits: | ||
orderable: !include raml-util/traits/orderable.raml | ||
pageable: !include raml-util/traits/pageable.raml | ||
searchable: !include raml-util/traits/searchable.raml | ||
validate: !include raml-util/traits/validation.raml | ||
|
||
resourceTypes: | ||
collection: !include raml-util/rtypes/collection.raml | ||
collection-item: !include raml-util/rtypes/item-collection.raml | ||
|
||
/orders-storage/routing-lists: | ||
type: | ||
collection: | ||
exampleCollection: !include acq-models/mod-orders-storage/examples/routing_list_collection.sample | ||
exampleItem: !include acq-models/mod-orders-storage/examples/routing_list_get.sample | ||
schemaCollection: routing-list-collection | ||
schemaItem: routing-list | ||
get: | ||
description: Get collection of routing lists | ||
is: [ | ||
searchable: { description: "CQL query", example: "name=MyRoutingList" }, | ||
pageable | ||
] | ||
post: | ||
description: Create a new routing list record | ||
body: | ||
application/json: | ||
type: routing-list | ||
example: | ||
strict: false | ||
value: !include acq-models/mod-orders-storage/examples/routing_list_get.sample | ||
responses: | ||
201: | ||
description: "Returns a newly created item, with server-controlled fields like 'id' populated" | ||
body: | ||
application/json: | ||
example: !include acq-models/mod-orders-storage/examples/routing_list_get.sample | ||
400: | ||
description: "Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response." | ||
body: | ||
application/json: | ||
type: error | ||
401: | ||
description: "Not authorized to perform requested action" | ||
body: | ||
application/json: | ||
type: error | ||
500: | ||
description: "Internal server error, e.g. due to misconfiguration" | ||
body: | ||
application/json: | ||
type: error | ||
/{id}: | ||
uriParameters: | ||
id: | ||
description: The UUID of a Routing List | ||
type: UUID | ||
displayName: Routing List | ||
description: Get, Delete or Update a specific routing list | ||
type: | ||
collection-item: | ||
exampleItem: !include acq-models/mod-orders-storage/examples/routing_list_get.sample | ||
schema: routing-list | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.folio.rest.impl; | ||
|
||
import io.vertx.core.AsyncResult; | ||
import io.vertx.core.Context; | ||
import io.vertx.core.Handler; | ||
import org.folio.rest.annotations.Validate; | ||
import org.folio.rest.jaxrs.model.RoutingList; | ||
import org.folio.rest.jaxrs.model.RoutingListCollection; | ||
import org.folio.rest.jaxrs.resource.OrdersStorageRoutingLists; | ||
import org.folio.rest.persist.PgUtil; | ||
|
||
import javax.ws.rs.core.Response; | ||
import java.util.Map; | ||
|
||
import static org.folio.models.TableNames.ROUTING_LIST_TABLE; | ||
|
||
public class RoutingListsAPI implements OrdersStorageRoutingLists { | ||
|
||
@Override | ||
@Validate | ||
public void getOrdersStorageRoutingLists(String query, String totalRecords, int offset, int limit,Map<String, String> okapiHeaders, | ||
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) { | ||
PgUtil.get(ROUTING_LIST_TABLE, RoutingList.class, RoutingListCollection.class, query, offset, limit, okapiHeaders, | ||
vertxContext, GetOrdersStorageRoutingListsResponse.class, asyncResultHandler); | ||
} | ||
|
||
@Override | ||
@Validate | ||
public void postOrdersStorageRoutingLists(RoutingList entity, Map<String, String> okapiHeaders, | ||
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) { | ||
PgUtil.post(ROUTING_LIST_TABLE, entity, okapiHeaders, vertxContext, PostOrdersStorageRoutingListsResponse.class, asyncResultHandler); | ||
} | ||
|
||
@Override | ||
@Validate | ||
public void getOrdersStorageRoutingListsById(String id, Map<String, String> okapiHeaders, | ||
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) { | ||
PgUtil.getById(ROUTING_LIST_TABLE, RoutingList.class, id, okapiHeaders,vertxContext, GetOrdersStorageRoutingListsByIdResponse.class, asyncResultHandler); | ||
} | ||
|
||
@Override | ||
@Validate | ||
public void deleteOrdersStorageRoutingListsById(String id, Map<String, String> okapiHeaders, | ||
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) { | ||
PgUtil.deleteById(ROUTING_LIST_TABLE, id, okapiHeaders, vertxContext, DeleteOrdersStorageRoutingListsByIdResponse.class, asyncResultHandler); | ||
} | ||
|
||
@Override | ||
@Validate | ||
public void putOrdersStorageRoutingListsById(String id, RoutingList entity, Map<String, String> okapiHeaders, | ||
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) { | ||
PgUtil.put(ROUTING_LIST_TABLE, entity, id, okapiHeaders, vertxContext, PutOrdersStorageRoutingListsByIdResponse.class, asyncResultHandler); | ||
} | ||
|
||
} |
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
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
10 changes: 10 additions & 0 deletions
10
src/test/resources/mockdata/routing-lists/c0d13648-347b-4ac9-8c2f-5bc47248b871.json
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,10 @@ | ||
{ | ||
"id": "c0d13648-347b-4ac9-8c2f-5bc47248b871", | ||
"_version": 1, | ||
"name": "List name", | ||
"notes": "Original notes", | ||
"userIds": [ | ||
"d926d900-e27d-46d6-bba8-31e9d5c2cf44" | ||
], | ||
"poLineId": "baec48dd-1594-2712-be8f-de336bc83fcc" | ||
} |