refactor: split monolithic app.py into modular Flask application with factory pattern

- Created app/ package with 6 modules:
  - __init__.py: Application factory (create_app function)
  - routes.py: All route handlers (473 lines)
  - models.py: Data persistence layer (41 lines)
  - validators.py: Input validation functions (48 lines)
  - email_service.py: Email sending functions (85 lines)
  - utils.py: Utility functions (30 lines)

- Implemented Flask application factory pattern
- Created run.py as minimal entry point
- Updated all test imports to use new module structure
- Fixed template/static folder paths for package structure

- All 102 tests passing
- Improved maintainability with clear separation of concerns
- Follows Flask best practices for scalable applications
This commit is contained in:
2025-12-27 22:36:05 +01:00
parent 733ee756c7
commit f1d8bae6a1
18 changed files with 1254 additions and 229 deletions
+4 -4
View File
@@ -174,7 +174,7 @@ class TestFileDownload:
session_id = 'test-download-success'
# Create application directory and attachment
from app import get_attachments_path
from app.models import get_attachments_path
attachments_path = get_attachments_path(session_id)
Path(attachments_path).mkdir(parents=True, exist_ok=True)
@@ -215,7 +215,7 @@ class TestFileDownload:
session_id = 'test-download-unauthorized'
# Create application directory and attachment
from app import get_attachments_path
from app.models import get_attachments_path
attachments_path = get_attachments_path(session_id)
Path(attachments_path).mkdir(parents=True, exist_ok=True)
@@ -273,7 +273,7 @@ class TestFileDownload:
session_id = 'test-download-multiple'
# Create application directory
from app import get_attachments_path
from app.models import get_attachments_path
attachments_path = get_attachments_path(session_id)
Path(attachments_path).mkdir(parents=True, exist_ok=True)
@@ -318,7 +318,7 @@ class TestFileDownload:
session_id = 'test-download-special-chars'
# Create application directory
from app import get_attachments_path
from app.models import get_attachments_path
attachments_path = get_attachments_path(session_id)
Path(attachments_path).mkdir(parents=True, exist_ok=True)