From cdf7ee08d6127afd24ffff4c4301372d849a8068 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 24 May 2021 16:11:18 +0200 Subject: [PATCH] new: [api] add /list/project and /list/publisher endpoints --- backend/bin/server.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/backend/bin/server.py b/backend/bin/server.py index f21225a..51d2fba 100644 --- a/backend/bin/server.py +++ b/backend/bin/server.py @@ -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//', 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//', 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/') class lookup(Resource):