Working on persistence api

This commit is contained in:
Gert Wohlgemuth
2018-05-19 17:07:32 -07:00
parent 2da14fc554
commit 92d3afd6e8
4 changed files with 79 additions and 12 deletions

View File

@@ -19,11 +19,15 @@ def names(event, context):
"""
table = Persistence(os.environ['strategyTable'])
# map results and hide informations
data = list(map(lambda x: {'name': x['name'], 'public': x['public'], 'user': x['user']}, table.list()))
return {
"statusCode": 200,
"body": json.dumps(table.list())
"body": json.dumps(data)
}
def performance(event, context):
"""
returns the performance of the specified strategy
@@ -71,9 +75,8 @@ def submit(event, context):
# try to load the strategy
StrategyResolver().compile(data['name'], strategy)
# generate id
data['id'] = str(uuid.uuid4())
data['time'] = int(time.time() * 1000)
data['type'] = "strategy"
# save to DB
table = Persistence(os.environ['strategyTable'])