Пример #1
0
def delete_account(account_id):
    # NEED TO DELETE REFERENCES TO ACCOUNT FIRST !
    account = Account.get_account_by_id(account_id)
    db.session.delete(account)
    db.session.commit()
    return True
Пример #2
0
def update_account(account_id, account_patch):
    account = Account.get_account_by_id(account_id)
    for key, value in account_patch.items():
        setattr(account, key, value)
    db.session.commit()
    return account.full_view()
Пример #3
0
def get_account(account_id):
    account = Account.get_account_by_id(account_id)
    return None if account is None else account.full_view()
Пример #4
0
def get_account_by_id(account_id):
    account = Account.get_account_by_id(account_id)
    return account.full_view()
Пример #5
0
def get_current_account(token):
    accountIdFromToken = verify_token(token)
    account = Account.get_account_by_id(accountIdFromToken).full_view()
    return {"account": account}, 200