From fc11314eda6103d5055062c3035536c93784ea4c Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 5 Oct 2017 13:07:23 +0200 Subject: Change to flask_restplus --- archivist/server/tag.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 archivist/server/tag.py (limited to 'archivist/server/tag.py') diff --git a/archivist/server/tag.py b/archivist/server/tag.py new file mode 100644 index 0000000..96fafcd --- /dev/null +++ b/archivist/server/tag.py @@ -0,0 +1,19 @@ +from flask_restplus import Resource, fields, Namespace + +from .. import model as m + +api = Namespace('tag', description = 'Operations on tags') + +tag = api.model('Tag', { + 'name' : fields.String(required=True), + 'prefix' : fields.String, + 'description' : fields.String +}) + +@api.route('/') +class TagList(Resource): + + @api.marshal_list_with(tag) + def get(self): + """List all available tags.""" + return list(m.Tag.select().where(~m.Tag.default).dicts().iterator()) -- cgit v1.2.3-54-g00ecf