Skip to content

Commit

Permalink
Added friend relations to expedite adding transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Raghav Bhasin authored and Raghav Bhasin committed Aug 18, 2018
1 parent 023d464 commit b5c1792
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions DrackerAPI/API/users/data/GET/get_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ def lambda_handler(event, context):
response = table.scan(Select='ALL_ATTRIBUTES', FilterExpression=Attr('phone').begins_with(event['search']))['Items']
result = []
for item in response:
item.pop('email', None)
item.pop('customer_url', None)
item.pop('funding_source', None)
item.pop('friends', None)
result.append(item)
result.append(process_item(item))
return json.dumps(result)
else:
return get_all_users()
Expand All @@ -36,17 +32,17 @@ def get_all_users():
data = response['Items']
response = []
for item in data:
item.pop('email', None)
item.pop('customer_url', None)
item.pop('funding_source', None)
item.pop('friends', None)
response.append(item)
response.append(process_item(item))
return json.dumps(response)

def get_item_for_key(key):
item = table.get_item(Key={'phone' : key})['Item']
return process_item(item)

def process_item(item):
item.pop('email', None)
item.pop('customer_url', None)
item.pop('funding_source', None)
item.pop('friends', None)
return item
return item

0 comments on commit b5c1792

Please sign in to comment.