Add exceptions, models, schemas, services directories to modules: customers: - exceptions.py, models/, schemas/, services/ inventory: - exceptions.py, models/, schemas/, services/ messaging: - exceptions.py, models/, schemas/, services/ monitoring: - exceptions.py, models/, schemas/, services/ orders: - exceptions.py, models/, schemas/, services/ payments: - Updated __init__.py All modules now have the standard self-contained directory structure ready for future migration of business logic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
# app/modules/messaging/definition.py
|
|
"""
|
|
Messaging module definition.
|
|
|
|
Defines the messaging module including its features, menu items,
|
|
route configurations, and self-contained module settings.
|
|
"""
|
|
|
|
from app.modules.base import ModuleDefinition
|
|
from models.database.admin_menu_config import FrontendType
|
|
|
|
|
|
def _get_admin_router():
|
|
"""Lazy import of admin router to avoid circular imports."""
|
|
from app.modules.messaging.routes.admin import admin_router
|
|
|
|
return admin_router
|
|
|
|
|
|
def _get_vendor_router():
|
|
"""Lazy import of vendor router to avoid circular imports."""
|
|
from app.modules.messaging.routes.vendor import vendor_router
|
|
|
|
return vendor_router
|
|
|
|
|
|
# Messaging module definition
|
|
messaging_module = ModuleDefinition(
|
|
code="messaging",
|
|
name="Messaging & Notifications",
|
|
description="Internal messages, customer communication, and notifications.",
|
|
version="1.0.0",
|
|
features=[
|
|
"customer_messaging", # Customer communication
|
|
"internal_messages", # Internal team messages
|
|
"notification_center", # Notification management
|
|
"message_attachments", # File attachments
|
|
"admin_notifications", # System admin notifications
|
|
],
|
|
menu_items={
|
|
FrontendType.ADMIN: [
|
|
"messages", # Admin messages
|
|
"notifications", # Admin notifications
|
|
],
|
|
FrontendType.VENDOR: [
|
|
"messages", # Vendor messages
|
|
"notifications", # Vendor notifications
|
|
],
|
|
},
|
|
is_core=False,
|
|
# =========================================================================
|
|
# Self-Contained Module Configuration
|
|
# =========================================================================
|
|
is_self_contained=True,
|
|
services_path="app.modules.messaging.services",
|
|
models_path="app.modules.messaging.models",
|
|
schemas_path="app.modules.messaging.schemas",
|
|
exceptions_path="app.modules.messaging.exceptions",
|
|
)
|
|
|
|
|
|
def get_messaging_module_with_routers() -> ModuleDefinition:
|
|
"""
|
|
Get messaging module with routers attached.
|
|
|
|
This function attaches the routers lazily to avoid circular imports
|
|
during module initialization.
|
|
"""
|
|
messaging_module.admin_router = _get_admin_router()
|
|
messaging_module.vendor_router = _get_vendor_router()
|
|
return messaging_module
|
|
|
|
|
|
__all__ = ["messaging_module", "get_messaging_module_with_routers"]
|