mirror of
https://github.com/adulau/hashlookup-server.git
synced 2024-11-23 18:47:11 +00:00
chg: [server] add children hashes if these exist
This commit is contained in:
parent
e9fb182c82
commit
a8b951cf83
1 changed files with 10 additions and 0 deletions
|
@ -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/<string: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')
|
||||
|
|
Loading…
Reference in a new issue