Added comments
This commit is contained in:
@@ -27,6 +27,7 @@ __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file
|
||||
def add_transaction(data):
|
||||
email = get_email_or_abort_401()
|
||||
|
||||
# Check if required data is available
|
||||
if not check_if_symbol_data_exists(data):
|
||||
abort(400, "Symbol missing")
|
||||
|
||||
@@ -39,6 +40,7 @@ def add_transaction(data):
|
||||
if not check_if_price_data_exists(data):
|
||||
abort(400, "Price missing")
|
||||
|
||||
# Add transaction
|
||||
new_transaction = Transaction(
|
||||
email=email,
|
||||
symbol=data['symbol'],
|
||||
@@ -60,8 +62,11 @@ def get_transaction():
|
||||
email = get_email_or_abort_401()
|
||||
|
||||
return_transactions = []
|
||||
|
||||
# Get all transactions
|
||||
transactions = db.session.query(Transaction).filter_by(email=email).all()
|
||||
|
||||
# Iterate over transactions and add them to return_transactions
|
||||
if transactions is not None:
|
||||
for row in transactions:
|
||||
return_transactions.append(row.as_dict())
|
||||
|
Reference in New Issue
Block a user