All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 24s
- Added tracking events for tasks, penalties, and rewards with timestamps. - Created new TinyDB table for tracking records to maintain audit history. - Developed backend API for querying tracking events with filters and pagination. - Implemented logging for tracking events with per-user rotating log files. - Added unit tests for tracking event creation, querying, and anonymization. - Deferred frontend changes for future implementation. - Established acceptance criteria and documentation for the tracking feature. feat: Introduce account deletion scheduler - Implemented a scheduler to delete accounts marked for deletion after a configurable threshold. - Added new fields to the User model to manage deletion status and attempts. - Created admin API endpoints for managing deletion thresholds and viewing the deletion queue. - Integrated error handling and logging for the deletion process. - Developed unit tests for the deletion scheduler and related API endpoints. - Documented the deletion process and acceptance criteria.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
# python
|
|
# file: config/paths.py
|
|
import os
|
|
|
|
# Constant directory names
|
|
DATA_DIR_NAME = 'data'
|
|
TEST_DATA_DIR_NAME = 'test_data'
|
|
|
|
# Project root (two levels up from this file)
|
|
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
def get_base_data_dir(data_env: str | None = None) -> str:
|
|
"""
|
|
Return the absolute base data directory path for the given env.
|
|
data_env: 'prod' uses `data`, anything else uses `test_data`.
|
|
"""
|
|
env = (data_env or os.environ.get('DATA_ENV', 'prod')).lower()
|
|
base_name = DATA_DIR_NAME if env == 'prod' else TEST_DATA_DIR_NAME
|
|
return os.path.join(PROJECT_ROOT, base_name)
|
|
|
|
def get_database_dir(db_env: str | None = None) -> str:
|
|
"""
|
|
Return the absolute base directory path for the given DB env.
|
|
db_env: 'prod' uses `data/db`, anything else uses `test_data/db`.
|
|
"""
|
|
env = (db_env or os.environ.get('DB_ENV', 'prod')).lower()
|
|
return os.path.join(PROJECT_ROOT, get_base_data_dir(env), 'db')
|
|
|
|
def get_user_image_dir(username: str | None) -> str:
|
|
"""
|
|
Return the absolute directory path for storing images for a specific user.
|
|
"""
|
|
if username:
|
|
return os.path.join(PROJECT_ROOT, get_base_data_dir(), 'images', username)
|
|
return os.path.join(PROJECT_ROOT, 'resources', 'images')
|
|
|
|
def get_logs_dir() -> str:
|
|
"""
|
|
Return the absolute directory path for application logs.
|
|
"""
|
|
return os.path.join(PROJECT_ROOT, 'logs')
|