The old migration chain was broken (downgrade path through vendor->merchant rename made rollbacks impossible). This squashes everything into fresh per-module migrations with zero schema drift, verified by autogenerate. Changes: - Replace 75 accumulated migrations with 12 per-module initial migrations (core, billing, catalog, marketplace, cms, customers, orders, inventory, cart, messaging, loyalty, dev_tools) in a linear chain - Fix make db-reset to use SQL DROP SCHEMA instead of alembic downgrade base - Enable migration autodiscovery for all modules (migrations_path in definitions) - Rewrite alembic/env.py to import all 75 model tables across 13 modules - Fix AdminNotification import (was incorrectly from tenancy, now from messaging) - Update squash_migrations.py to handle all module migration directories Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
108 lines
3.8 KiB
Python
108 lines
3.8 KiB
Python
# app/modules/dev_tools/definition.py
|
|
"""
|
|
Dev-Tools module definition.
|
|
|
|
Defines the dev-tools module including its features, menu items,
|
|
route configurations, and task definitions.
|
|
|
|
Dev-Tools is an internal module providing:
|
|
- Code quality scanning (architecture, security, performance validators)
|
|
- Test execution and results management
|
|
- Component library browser
|
|
- Icon browser
|
|
"""
|
|
|
|
from app.modules.base import MenuItemDefinition, MenuSectionDefinition, ModuleDefinition
|
|
from app.modules.enums import FrontendType
|
|
|
|
|
|
# Dev-Tools module definition
|
|
# Note: API routes (code quality, tests) have been moved to monitoring module.
|
|
# This module retains models, services, and page routes only.
|
|
dev_tools_module = ModuleDefinition(
|
|
code="dev-tools",
|
|
name="Developer Tools",
|
|
description=(
|
|
"Internal development tools including code quality scanning, "
|
|
"test execution, component library, and icon browser."
|
|
),
|
|
version="1.0.0",
|
|
features=[
|
|
"component_library", # UI component browser
|
|
"icon_browser", # Icon library browser
|
|
"code_quality", # Code quality scanning
|
|
"architecture_validation", # Architecture validator
|
|
"security_validation", # Security validator
|
|
"performance_validation", # Performance validator
|
|
"test_runner", # Test execution
|
|
"violation_management", # Violation tracking and assignment
|
|
],
|
|
menu_items={
|
|
FrontendType.ADMIN: [
|
|
"components", # Component library page
|
|
"icons", # Icon browser page
|
|
"code-quality", # Code quality dashboard
|
|
"tests", # Test runner dashboard
|
|
],
|
|
FrontendType.STORE: [], # No store menu items - internal module
|
|
},
|
|
# New module-driven menu definitions
|
|
menus={
|
|
FrontendType.ADMIN: [
|
|
MenuSectionDefinition(
|
|
id="devTools",
|
|
label_key="dev_tools.menu.developer_tools",
|
|
icon="view-grid",
|
|
order=85,
|
|
is_super_admin_only=True,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="components",
|
|
label_key="dev_tools.menu.components",
|
|
icon="view-grid",
|
|
route="/admin/components",
|
|
order=10,
|
|
),
|
|
MenuItemDefinition(
|
|
id="icons",
|
|
label_key="dev_tools.menu.icons",
|
|
icon="photograph",
|
|
route="/admin/icons",
|
|
order=20,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
},
|
|
is_core=False,
|
|
is_internal=True, # Internal module - admin-only, not customer-facing
|
|
# =========================================================================
|
|
# Self-Contained Module Configuration
|
|
# =========================================================================
|
|
is_self_contained=True,
|
|
services_path="app.modules.dev_tools.services",
|
|
models_path="app.modules.dev_tools.models",
|
|
schemas_path="app.modules.dev_tools.schemas",
|
|
exceptions_path="app.modules.dev_tools.exceptions",
|
|
tasks_path="app.modules.dev_tools.tasks",
|
|
migrations_path="migrations",
|
|
# Note: Code quality and test tasks are on-demand, not scheduled.
|
|
# If scheduled scans are desired, add ScheduledTask entries here.
|
|
)
|
|
|
|
|
|
def get_dev_tools_module_with_routers() -> ModuleDefinition:
|
|
"""
|
|
Get dev-tools module definition.
|
|
|
|
Note: API routes have been moved to monitoring module.
|
|
This module has no routers to attach.
|
|
"""
|
|
# No routers - API routes are now in monitoring module
|
|
dev_tools_module.admin_router = None
|
|
dev_tools_module.store_router = None
|
|
return dev_tools_module
|
|
|
|
|
|
__all__ = ["dev_tools_module", "get_dev_tools_module_with_routers"]
|