mirror of
https://github.com/adulau/hashlookup-server.git
synced 2024-12-24 17:56:03 +00:00
chg: [api] lookup add parent details
This commit is contained in:
parent
8504b492f7
commit
a17cd38595
1 changed files with 13 additions and 0 deletions
|
@ -93,6 +93,12 @@ class lookup(Resource):
|
|||
if "ProductCode" in h:
|
||||
if rdb.exists("h-ProductCode:{}".format(h['ProductCode'])):
|
||||
h['ProductCode'] = rdb.hgetall("h-ProductCode:{}".format(h['ProductCode']))
|
||||
if rdb.exists("p:{}".format(sha1)):
|
||||
parents = []
|
||||
for parent in rdb.smembers("p:{}".format(sha1)):
|
||||
parent_details = rdb.hgetall("h:{}".format(parent))
|
||||
parents.append(parent_details)
|
||||
h['parents'] = parents
|
||||
return h
|
||||
|
||||
@api.route('/lookup/sha1/<string:sha1>')
|
||||
|
@ -132,6 +138,13 @@ class lookup(Resource):
|
|||
if "ProductCode" in h:
|
||||
if rdb.exists("h-ProductCode:{}".format(h['ProductCode'])):
|
||||
h['ProductCode'] = rdb.hgetall("h-ProductCode:{}".format(h['ProductCode']))
|
||||
if rdb.exists("p:{}".format(k)):
|
||||
parents = []
|
||||
for parent in rdb.smembers("p:{}".format(sha1)):
|
||||
parent_details = rdb.hgetall("h:{}".format(parent))
|
||||
parents.append(parent_details)
|
||||
h['parents'] = parents
|
||||
|
||||
return h
|
||||
|
||||
@api.route('/info')
|
||||
|
|
Loading…
Reference in a new issue