Fix To-Do. Deleted non backend tasks and added important note about collect system.
Added COLLECT_COOLDOWN default to 24 hours if not set in env. Fixed .gitignore to ignore vscode settings and python cache files. Added new transaction history to To-Do and marked as finished - Needs to be tested´ why tf am I commiting this on main branch?
This commit is contained in:
parent
ec88bad538
commit
94ed01c88a
3 changed files with 26 additions and 9 deletions
|
|
@ -76,7 +76,23 @@ def collect():
|
|||
current_app.logger.error(f"An unexpected error occurred in /collect: {e}")
|
||||
return jsonify({"error": "An unexpected server error occurred."}), 500
|
||||
|
||||
|
||||
@transactions_bp.route('/transactions', methods=['GET'])
|
||||
@jwt_required
|
||||
def get_transactions():
|
||||
user_bid = request.bid
|
||||
limit = request.args.get('limit', default=10, type=int)
|
||||
try:
|
||||
with db.cursor(dictionary=True) as cur:
|
||||
cur.execute("SELECT * FROM transactions WHERE source = %s OR target = %s ORDER BY timestamp DESC LIMIT %s", (user_bid, user_bid, limit))
|
||||
transactions = cur.fetchall()
|
||||
return jsonify({"transactions": transactions}), 200
|
||||
except mysql.connector.Error as err:
|
||||
current_app.logger.error(f"Database error in /transactions: {err}")
|
||||
return jsonify({"error": "A database error occurred, please try again later."}), 500
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"An unexpected error occurred in /transactions: {e}")
|
||||
return jsonify({"error": "An unexpected server error occurred."}), 500
|
||||
|
||||
|
||||
# this should be fine
|
||||
@transactions_bp.route('/transfer', methods=['POST'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue