def get_account(account_id): # noqa: E501 """Get account info Get a given user name # noqa: E501 :param account_id: The user id of the logged in user :type account_id: int :rtype: str """ db = PostgresDB() account = db.get_account_by_id(account_id) if "Error" in account: return jsonify(msg=account) if len(account) > 0: account = account[0] return jsonify({"username": account[1], "birthdate": account[3], "age": account[4]}) return jsonify(msg='Account not found'), 404
def delete_account(account_id): # noqa: E501 """Delete the account Delete a given user account # noqa: E501 :param account_id: Account id :type account_id: int :rtype: str """ db = PostgresDB() account = db.get_account_by_id(account_id) if "Error" in account: return jsonify(msg=account) if len(account) > 0: error = db.delete_account(account_id) if error: return jsonify(msg=error) return jsonify(msg='The account has been removed'), 200 else: return jsonify(msg='Account not found' % account_id), 404