new: [api] add /list/project and /list/publisher endpoints

main
Alexandre Dulaunoy 2021-05-24 16:11:18 +02:00
parent be16de1d8f
commit cdf7ee08d6
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 20 additions and 0 deletions

View File

@ -48,6 +48,26 @@ class generateUUID(Resource):
class favicon(Resource):
def get(self):
return send_from_directory(os.path.join(app.root_path, 'static'),'favicon.ico',mimetype='image/vnd.microsoft.icon')
@api.route('/list/publisher/<int:start>/<int:end>', defaults={"start": 0, "end": 10})
class list_publisher(Resource):
def get(self, start=0, end=10):
uuids = r.zrange('t:1', start, end)
publishers = []
for uuidvalue in uuids:
_publisher = r.hgetall('1:{}'.format(uuidvalue))
publishers.append(_publisher)
return publishers
@api.route('/list/project/<int:start>/<int:end>', defaults={"start": 0, "end": 10})
class list_project(Resource):
def get(self, start=0, end=10):
uuids = r.zrange('t:2', start, end)
publishers = []
for uuidvalue in uuids:
_publisher = r.hgetall('2:{}'.format(uuidvalue))
publishers.append(_publisher)
return publishers
@api.route('/lookup/<string:uuid>')
class lookup(Resource):