summaryrefslogtreecommitdiff
path: root/archivist/server/tag.py
blob: 96fafcd29b2f5cd794ef85c0cfebd9e5cf975308 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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())