diff --git a/api/app.py b/api/app.py index b94f0edae2..18694d31e2 100644 --- a/api/app.py +++ b/api/app.py @@ -9,7 +9,7 @@ from logger import create_log from .blueprints import ( - search, work, info, edition, editions, utils, link, opds, collection, citation, fulfill + search, work, info, edition, editions, utils, link, opds, collection, collections, citation, fulfill ) from .utils import APIUtils @@ -36,6 +36,7 @@ def __init__(self, dbEngine, redisClient): self.app.register_blueprint(link) self.app.register_blueprint(opds) self.app.register_blueprint(collection) + self.app.register_blueprint(collections) self.app.register_blueprint(citation) self.app.register_blueprint(fulfill) diff --git a/api/blueprints/__init__.py b/api/blueprints/__init__.py index b30bbd502d..bdcd8eff23 100644 --- a/api/blueprints/__init__.py +++ b/api/blueprints/__init__.py @@ -1,5 +1,5 @@ from .drbCitation import citation -from .drbCollection import collection +from .drbCollection import collection, collections from .drbEdition import edition, editions from .drbInfo import info from .drbLink import link diff --git a/api/blueprints/drbCollection.py b/api/blueprints/drbCollection.py index eca3558fe5..f9657027f7 100644 --- a/api/blueprints/drbCollection.py +++ b/api/blueprints/drbCollection.py @@ -19,6 +19,7 @@ logger = create_log(__name__) collection = Blueprint('collection', __name__, url_prefix='/collection') +collections = Blueprint('collections', __name__, url_prefix='/collections') def validateToken(func): @@ -57,6 +58,7 @@ def decorator(*args, **kwargs): @collection.route('', methods=['POST']) +@collections.route('', methods=['POST']) @validateToken def collectionCreate(user=None): logger.info('Creating new collection') @@ -139,6 +141,7 @@ def _validateAutoCollectionDef(autoDef: dict) -> str: @collection.route('/replace/', methods=['POST']) +@collections.route('/replace/', methods=['POST']) @validateToken def collectionReplace(uuid, user=None): logger.info('Handling collection replacement request') @@ -190,6 +193,7 @@ def collectionReplace(uuid, user=None): return APIUtils.formatOPDS2Object(201, opdsFeed) @collection.route('/update/', methods=['POST']) +@collections.route('/update/', methods=['POST']) @validateToken def collectionUpdate(uuid, user=None): logger.info('Handling collection update request') @@ -259,6 +263,7 @@ def collectionUpdate(uuid, user=None): @collection.route('/', methods=['GET']) +@collections.route('/', methods=['GET']) def get_collection(uuid): logger.info(f'Getting collection with id {uuid}') response_type = 'fetchCollection' @@ -291,6 +296,7 @@ def get_collection(uuid): return APIUtils.formatResponseObject(500, response_type, { 'message': f'Unable to get collection with id {uuid}' }) @collection.route('/', methods=['DELETE']) +@collections.route('/', methods=['DELETE']) @validateToken def collectionDelete(uuid, user=None): logger.info('Deleting collection {}'.format(uuid)) @@ -311,6 +317,7 @@ def collectionDelete(uuid, user=None): return (jsonify({'message': 'Deleted {}'.format(uuid)}), 200) @collection.route('/delete/', methods=['DELETE']) +@collections.route('/delete/', methods=['DELETE']) @validateToken def collectionDeleteWorkEdition(uuid, user=None): logger.info('Handling collection work/edition deletion request') @@ -355,6 +362,7 @@ def collectionDeleteWorkEdition(uuid, user=None): @collection.route('/list', methods=['GET']) +@collections.route('', methods=['GET']) def get_collections(): logger.info('Getting all collections') response_type = 'collectionList' diff --git a/swagger.v4.json b/swagger.v4.json index 322d3b0bb9..0fe87e0e24 100644 --- a/swagger.v4.json +++ b/swagger.v4.json @@ -596,7 +596,7 @@ } } }, - "/collection": { + "/collections": { "post": { "tags": ["digital-research-books"], "summary": "Create DRB Collection", @@ -699,7 +699,7 @@ } } }, - "/collection/{uuid}": { + "/collections/{uuid}": { "get": { "tags": ["digital-research-books"], "summary": "Return DRB Collection", @@ -800,7 +800,7 @@ } } }, - "/collection/replace/{uuid}": { + "/collections/replace/{uuid}": { "post": { "tags": ["digital-research-books"], "summary": "Replace a DRB Collection", @@ -880,7 +880,7 @@ } } }, - "/collection/update/{uuid}": { + "/collections/update/{uuid}": { "post": { "tags": ["digital-research-books"], "summary": "Update a DRB Collection", @@ -962,7 +962,7 @@ } } }, - "/collection/delete/{uuid}": { + "/collections/delete/{uuid}": { "delete": { "tags": ["digital-research-books"], "summary": "Delete a Edition/Work from a DRB Collection", @@ -1016,7 +1016,7 @@ } } }, - "/collection/list": { + "/collections/list": { "get": { "tags": ["digital-research-books"], "summary": "Return list of DRB Collections",