def get(self): """List all graphs from DB.""" args = search_parser.parse_args(request) try: page = args.get('page') per_page = args.get('per_page') res = facade.list_graphs(page, per_page) except JSONDecodeError: raise gmap_exc.SearchException('Parameter query is invalid') else: return res, 200
def get(self): """List all collections of kind document from DB.""" args = search_parser.parse_args(request) try: query = args.get('query') or '[]' page = args.get('page') per_page = args.get('per_page') data = json.loads(query) res = facade.list_collections('document', data, page, per_page) except JSONDecodeError: raise gmap_exc.SearchException('Parameter query is invalid') else: return res, 200
def get(self, collection): """Get count documents.""" args = search_parser.parse_args(request) try: query = args.get('query') or '[]' data = json.loads(query) res = facade.count_document(collection, data) return res, 200 except gmap_exc.CollectionNotExist as err: app.logger.error(err.message) api.abort(404, errors=err.message) except gmap_exc.DocumentNotExist as err: app.logger.warning(err.message) api.abort(404, errors=err.message)