diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-03 07:11:37 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-03 07:11:37 +0100 |
commit | da929a367c3f1fe5f3546be82e47111c2fa84ad3 (patch) | |
tree | 89380f41b802256d8fdbf724e7d9e63b48209b4a /src/web/views/api/category.py | |
parent | Merge pull request #30 from jaesivsm/master (diff) | |
parent | writing a bit of doc, moving crawler together (diff) | |
download | newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.tar.gz newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.tar.bz2 newspipe-da929a367c3f1fe5f3546be82e47111c2fa84ad3.zip |
Merge pull request #31 from jaesivsm/master
redoing UI
Diffstat (limited to 'src/web/views/api/category.py')
-rw-r--r-- | src/web/views/api/category.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/web/views/api/category.py b/src/web/views/api/category.py new file mode 100644 index 00000000..7923279a --- /dev/null +++ b/src/web/views/api/category.py @@ -0,0 +1,31 @@ +from flask import g + +from web.controllers.category import CategoryController +from web.views.api.common import (PyAggResourceNew, + PyAggResourceExisting, + PyAggResourceMulti) + + +CAT_ATTRS = {'name': {'type': str}, + 'user_id': {'type': int}} + + +class CategoryNewAPI(PyAggResourceNew): + controller_cls = CategoryController + attrs = CAT_ATTRS + + +class CategoryAPI(PyAggResourceExisting): + controller_cls = CategoryController + attrs = CAT_ATTRS + + +class CategoriesAPI(PyAggResourceMulti): + controller_cls = CategoryController + attrs = CAT_ATTRS + + +g.api.add_resource(CategoryNewAPI, '/category', endpoint='category_new.json') +g.api.add_resource(CategoryAPI, '/category/<int:obj_id>', + endpoint='category.json') +g.api.add_resource(CategoriesAPI, '/categories', endpoint='categories.json') |