chg: [server] add children hashes if these exist

This commit is contained in:
Alexandre Dulaunoy 2021-08-24 14:53:43 +02:00
parent e9fb182c82
commit a8b951cf83
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -99,6 +99,11 @@ class lookup(Resource):
parent_details = rdb.hgetall("h:{}".format(parent)) parent_details = rdb.hgetall("h:{}".format(parent))
parents.append(parent_details) parents.append(parent_details)
h['parents'] = parents 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 return h
@api.route('/lookup/sha1/<string:sha1>') @api.route('/lookup/sha1/<string:sha1>')
@ -144,6 +149,11 @@ class lookup(Resource):
parent_details = rdb.hgetall("h:{}".format(parent)) parent_details = rdb.hgetall("h:{}".format(parent))
parents.append(parent_details) parents.append(parent_details)
h['parents'] = parents 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 return h
@api.route('/info') @api.route('/info')