Copyright (C) 2016 The Open Library Foundation
This software is distributed under the terms of the Apache License, Version 2.0. See the file "LICENSE" for more information.
Demo circulation module exposing some circulation apis and objects based on the raml-module-builder framework against a MongoDB
This project is built using the raml-module-builder, using the MongoDB async client to implement some basic circulation APIs. The project also includes a small demo of the drools functionality. It is highly recommended to read the raml-module-builder README
APIs Implemented:
- Bib CRUD
- Item CRUD
- Patron CRUD
Objects / Schemas:
- Bibs
- Items
- Item request
- Fines
- Loans
- Patrons
Can be run in both embedded mongodb mode or with a regular MongoDB server
instructions:
clone / download the raml-module-builder and mvn clean install
then do the same for the current project mvn clean install
Run:
java -jar circulation-fat.jar -Dhttp.port=8084 embed_mongo=true
Or via dockerfile
Note that the embedded mongo is started on a dynamic port chosen at embedded mongo start up - refer to the log ("created embedded mongo config on port 54851")
See https://github.com/folio-org/raml-module-builder#command-line-options for additional cmd line options.
documentation of the APIs can be found at:
http://localhost:8084/apidocs/index.html?raml=raml/circulation/items.raml
Make sure to include appropriate headers as the runtime framework validates them
Accept: application/json
Content-Type: application/json
Some Examples (ids should be replaced with actual ids from the DB, Json object examples can be seen after the API list or in the json schema files in the /ramls dir):
Patron Object:
{
"status": "ACTIVE",
"user_id": "1234567",
"patron_barcode": "00007888",
"patron_local_id": "abcdefd",
"total_loans": 50,
"total_fines": "100$",
"total_fines_paid": "0$",
"patron_code": {
"value": "CH",
"description": "Child"
}
}
Fine Object:
{
"fine_amount": 10,
"fine_outstanding": 0,
"fine_date": 1413879432,
"fine_pay_in_full": true,
"fine_pay_in_partial": false,
"fine_note": "aaaaaa",
"item_id": "56dbe160a129584dc8de7973",
"fine_forgiven": {
"user": "the cool librarian",
"amount": "none"
},
"patron_id": "56dbe25ea12958478cec42ba"
}
Loan Object:
{
"circ_desk": {
"value": "MAIN_CIRC",
"desc": "Joe's Circulation Desk"
},
"library": {
"value": "ULAW",
"desc": "Main Library"
},
"patron_id": "56dbe25ea12958478cec42ba",
"item_barcode": "000000055510000222",
"item_id": "23344156380001021",
"due_date": 1413813699999,
"loan_status": "ACTIVE",
"loan_date": 1403434999999,
"loan_fine": 0,
"title": "History today",
"author": "me",
"description": "",
"publication_year": 2000,
"call_number": "1234567890",
"renewable": false,
"location_code": {
"value": "1234567890",
"name": "1234567890"
},
"item_policy": {
"value": 2,
"description": "2 Week Loan"
}
}
Item Object:
{
"barcode": "39031031697261",
"location": {
"value": "STACK",
"desc": "Stacks (STACK)"
},
"status": {
"value": "01",
"desc": "ITEM_STATUS_MISSING"
},
"material_type": {
"value": "BOOK",
"desc": "Book",
"icon": "book.png"
},
"shelf_location": {
"classification_number": "1234567890",
"shelf_listing_number": "12345678"
},
"copy_id": "1",
"item_link": "/bibs/99100383909999/item/1234567890009999",
"bib_id": "99100383909999"
}
Request Item Object:
{
"request_status": "NOT_STARTED",
"place_in_queue": 11,
"request_date": "2015-12-12",
"request_type": "HOLD|RECALL|MOVE|DIGITIZATION|BOOKING|ETC...",
"pickup_location": "MATHLIB",
"item_id": "23344156380001021",
"bib_id": "13344156380001021",
"patron_id": "Me123"
}
The raml-module-builder framework.
Other modules.
Other FOLIO Developer documentation is at dev.folio.org