This commit addresses several issues in the `/collect` endpoint to improve its security and robustness. It also introduces a `To-Do.md` file as requested by the user. Key changes: - Refactored the `/collect` endpoint to use a single database transaction, preventing data inconsistencies. - Fixed SQL injection vulnerabilities by converting all database queries to use parameterized statements. - Corrected a `TypeError` by ensuring the `COLLECT_COOLDOWN` configuration variable is always an integer. - Updated transaction logging to record 'SYSTEM' as the source of funds for salary collections, instead of a "NULL" string. - Added a `To-Do.md` file with suggestions for future features, including an automated payroll system, user transaction history, and an admin panel.
21 lines
588 B
Python
21 lines
588 B
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# Find the absolute path of the root directory
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
load_dotenv(os.path.join(basedir, '.env'))
|
|
|
|
class Config:
|
|
# General Config
|
|
JWT_KEY = os.getenv('JWT_KEY')
|
|
JWT_EXPIRE = int(os.getenv('JWT_EXPIRATION', 30))
|
|
|
|
# Database
|
|
DB_HOST = os.getenv('DB_HOST')
|
|
DB_USER = os.getenv('DB_USER')
|
|
DB_PASSWORD = os.getenv('DB_PASSWORD')
|
|
DB_NAME = os.getenv('DB_NAME')
|
|
|
|
# Admin
|
|
ADMIN_KEY = os.getenv('ADMIN_KEY')
|
|
COLLECT_COOLDOWN = int(os.getenv('COLLECT_COOLDOWN', 24))
|