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:
MrEisbear 2025-09-20 19:49:44 -05:00
parent ec88bad538
commit 94ed01c88a
3 changed files with 26 additions and 9 deletions

6
.gitignore vendored
View file

@ -1,3 +1,9 @@
.venv/ .venv/
.env .env
.idea/ .idea/
.vscode/
__pycache__/
*.pyc
instance/
db.sqlite3

View file

@ -7,16 +7,11 @@ This file tracks potential new features and improvements for the Interbend banki
1. **Automated Payroll System:** 1. **Automated Payroll System:**
* **Description:** Instead of requiring users to manually call the `/collect` endpoint, a scheduled script could run periodically (e.g., every 24 hours) to automatically distribute salaries to all eligible users. * **Description:** Instead of requiring users to manually call the `/collect` endpoint, a scheduled script could run periodically (e.g., every 24 hours) to automatically distribute salaries to all eligible users.
* **Benefits:** Improves user experience, ensures consistent pay, and reduces repeated API calls to the server. * **Benefits:** Improves user experience, ensures consistent pay, and reduces repeated API calls to the server.
* **Important:** Due to the concept of this whole system it needs to be considered to only pay users who are attend. Bad Idea.
* **Alternative:** Implement system to make sure you can only collect if the host is online. Make admin route to open server (set global bool)
2. **User Transaction History:** 2. **User Transaction History:**
* **Description:** Create a new API endpoint (e.g., `GET /transactions`) that allows an authenticated user to retrieve a paginated list of their own transaction history. * **Description:** Create a new API endpoint (e.g., `GET /transactions`) that allows an authenticated user to retrieve a paginated list of their own transaction history.
* **Benefits:** Provides users with transparency and a way to track their finances, which is a core feature of any banking application. * **Benefits:** Provides users with transparency and a way to track their finances, which is a core feature of any banking application.
3. **Comprehensive Admin Panel:** * FINISHED: PLEASE CHECK IF WORKING!
* **Description:** Develop a simple web-based dashboard for administrators. This would be more user-friendly than using API endpoints for administrative tasks.
* **Features:**
* View and manage all users (e.g., edit balance, change job, view profile).
* Manage jobs and their corresponding salaries.
* View system-wide transaction logs and financial statistics.
* A secure login system for administrators.
* **Benefits:** Greatly simplifies the management of the roleplay economy and provides better oversight.

View file

@ -76,6 +76,22 @@ def collect():
current_app.logger.error(f"An unexpected error occurred in /collect: {e}") current_app.logger.error(f"An unexpected error occurred in /collect: {e}")
return jsonify({"error": "An unexpected server error occurred."}), 500 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 # this should be fine