feat: add module config and migrations auto-discovery infrastructure
Add self-contained configuration and migrations support for modules:
Config auto-discovery (app/modules/config.py):
- Modules can have config.py with Pydantic Settings
- Environment variables prefixed with MODULE_NAME_
- Auto-discovered via get_module_config()
Migrations auto-discovery:
- Each module has migrations/versions/ directory
- Alembic discovers module migrations automatically
- Naming convention: {module}_{seq}_{description}.py
New architecture rules (MOD-013 to MOD-015):
- MOD-013: config.py should export config/config_class
- MOD-014: Migrations must follow naming convention
- MOD-015: Migrations directory must have __init__.py
Created for all 11 self-contained modules:
- config.py placeholder files
- migrations/ directories with __init__.py files
Added core and tenancy module definitions for completeness.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
11
app/modules/core/__init__.py
Normal file
11
app/modules/core/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# app/modules/core/__init__.py
|
||||
"""
|
||||
Core Platform module.
|
||||
|
||||
Provides dashboard, settings, and profile management.
|
||||
This is a core module that cannot be disabled.
|
||||
"""
|
||||
|
||||
from app.modules.core.definition import core_module
|
||||
|
||||
__all__ = ["core_module"]
|
||||
39
app/modules/core/definition.py
Normal file
39
app/modules/core/definition.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# app/modules/core/definition.py
|
||||
"""
|
||||
Core Platform module definition.
|
||||
|
||||
Dashboard, settings, and profile management.
|
||||
Required for basic operation - cannot be disabled.
|
||||
"""
|
||||
|
||||
from app.modules.base import ModuleDefinition
|
||||
from models.database.admin_menu_config import FrontendType
|
||||
|
||||
core_module = ModuleDefinition(
|
||||
code="core",
|
||||
name="Core Platform",
|
||||
description="Dashboard, settings, and profile management. Required for basic operation.",
|
||||
version="1.0.0",
|
||||
is_core=True,
|
||||
features=[
|
||||
"dashboard",
|
||||
"settings",
|
||||
"profile",
|
||||
],
|
||||
menu_items={
|
||||
FrontendType.ADMIN: [
|
||||
"dashboard",
|
||||
"settings",
|
||||
"email-templates",
|
||||
"my-menu",
|
||||
],
|
||||
FrontendType.VENDOR: [
|
||||
"dashboard",
|
||||
"profile",
|
||||
"settings",
|
||||
"email-templates",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
__all__ = ["core_module"]
|
||||
Reference in New Issue
Block a user