From a8b951cf83789b944e26b62e23f534998ca7d3ed Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 24 Aug 2021 14:53:43 +0200 Subject: [PATCH] chg: [server] add children hashes if these exist --- bin/server.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/server.py b/bin/server.py index 0861082..5a0787f 100644 --- a/bin/server.py +++ b/bin/server.py @@ -99,6 +99,11 @@ class lookup(Resource): parent_details = rdb.hgetall("h:{}".format(parent)) parents.append(parent_details) h['parents'] = parents + if rdb.exists("c:{}".format(sha1)): + children = [] + for child in rdb.smembers("c:{}".format(sha1)): + children.append(child) + h['children'] = children return h @api.route('/lookup/sha1/') @@ -144,6 +149,11 @@ class lookup(Resource): parent_details = rdb.hgetall("h:{}".format(parent)) parents.append(parent_details) h['parents'] = parents + if rdb.exists("c:{}".format(k)): + children = [] + for child in rdb.smembers("c:{}".format(k)): + children.append(child) + h['children'] = children return h @api.route('/info')