Refactor application to MVC architecture with Flask blueprints
Major architectural refactoring to improve code organization, maintainability, and scalability: - Implement MVC pattern with clear separation of concerns - Organize code into blueprints for different functional areas (main, tenant, admin, api) - Create models layer to encapsulate all database operations - Create services layer for business logic (auth, product, barcode) - Implement application factory pattern for better testability - Add environment-based configuration management - Remove old monolithic app.py and consolidate routes New structure: - app/models/ - Database operations (Tenant, Product, ARField, Settings) - app/services/ - Business logic (Auth, Product, Barcode services) - app/blueprints/ - Controllers organized by function - app/config.py - Environment configurations - run.py - Application entry point All routes remain backward compatible. No changes to API or templates functionality.
This commit is contained in:
7
src/app/blueprints/api/routes.py
Normal file
7
src/app/blueprints/api/routes.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from flask import jsonify
|
||||
from . import api_bp
|
||||
|
||||
@api_bp.route('/')
|
||||
def api_index(tenant_id):
|
||||
"""API home endpoint"""
|
||||
return jsonify({'message': 'API Home', 'tenant': tenant_id})
|
||||
Reference in New Issue
Block a user