Some checks failed
- Add complete hosting module (models, routes, schemas, services, templates, migrations) - Add HostWizard platform to init_production seed (code=hosting, domain=hostwizard.lu) - Fix cms_002 migration down_revision to z_unique_subdomain_domain - Fix prospecting_001 migration to chain after cms_002 (remove branch label) - Add hosting/prospecting version_locations to alembic.ini - Fix admin_services delete endpoint to use proper response model - Add hostwizard.lu to deployment docs (DNS, Caddy, Cloudflare) - Add hosting and prospecting user journey docs to mkdocs nav Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
133 lines
3.9 KiB
Python
133 lines
3.9 KiB
Python
# app/modules/hosting/definition.py
|
|
"""
|
|
Hosting module definition.
|
|
|
|
Web hosting, domains, email, and website building for Luxembourg businesses.
|
|
Manages POC → live website pipeline and operational service tracking.
|
|
Admin-only module for superadmin and platform admin users.
|
|
"""
|
|
|
|
from app.modules.base import (
|
|
MenuItemDefinition,
|
|
MenuSectionDefinition,
|
|
ModuleDefinition,
|
|
PermissionDefinition,
|
|
)
|
|
from app.modules.enums import FrontendType
|
|
|
|
|
|
def _get_admin_api_router():
|
|
"""Lazy import of admin API router to avoid circular imports."""
|
|
from app.modules.hosting.routes.api.admin import router
|
|
|
|
return router
|
|
|
|
|
|
def _get_admin_page_router():
|
|
"""Lazy import of admin page router to avoid circular imports."""
|
|
from app.modules.hosting.routes.pages.admin import router
|
|
|
|
return router
|
|
|
|
|
|
def _get_public_page_router():
|
|
"""Lazy import of public page router to avoid circular imports."""
|
|
from app.modules.hosting.routes.pages.public import router
|
|
|
|
return router
|
|
|
|
|
|
hosting_module = ModuleDefinition(
|
|
code="hosting",
|
|
name="Hosting",
|
|
description="Web hosting, domains, email, and website building for Luxembourg businesses.",
|
|
version="1.0.0",
|
|
is_core=False,
|
|
is_self_contained=True,
|
|
requires=["prospecting"],
|
|
permissions=[
|
|
PermissionDefinition(
|
|
id="hosting.view",
|
|
label_key="hosting.permissions.view",
|
|
description_key="hosting.permissions.view_desc",
|
|
category="hosting",
|
|
),
|
|
PermissionDefinition(
|
|
id="hosting.manage",
|
|
label_key="hosting.permissions.manage",
|
|
description_key="hosting.permissions.manage_desc",
|
|
category="hosting",
|
|
),
|
|
],
|
|
features=[
|
|
"hosting",
|
|
"domains",
|
|
"email",
|
|
"ssl",
|
|
"poc_sites",
|
|
],
|
|
menu_items={
|
|
FrontendType.ADMIN: [
|
|
"hosting-dashboard",
|
|
"hosting-sites",
|
|
"hosting-clients",
|
|
],
|
|
},
|
|
menus={
|
|
FrontendType.ADMIN: [
|
|
MenuSectionDefinition(
|
|
id="hosting",
|
|
label_key="hosting.menu.hosting",
|
|
icon="globe",
|
|
order=65,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="hosting-dashboard",
|
|
label_key="hosting.menu.dashboard",
|
|
icon="chart-bar",
|
|
route="/admin/hosting",
|
|
order=1,
|
|
),
|
|
MenuItemDefinition(
|
|
id="hosting-sites",
|
|
label_key="hosting.menu.sites",
|
|
icon="globe",
|
|
route="/admin/hosting/sites",
|
|
order=5,
|
|
),
|
|
MenuItemDefinition(
|
|
id="hosting-clients",
|
|
label_key="hosting.menu.clients",
|
|
icon="server",
|
|
route="/admin/hosting/clients",
|
|
order=10,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
},
|
|
migrations_path="migrations",
|
|
services_path="app.modules.hosting.services",
|
|
models_path="app.modules.hosting.models",
|
|
schemas_path="app.modules.hosting.schemas",
|
|
exceptions_path="app.modules.hosting.exceptions",
|
|
templates_path="templates",
|
|
locales_path="locales",
|
|
tasks_path="app.modules.hosting.tasks",
|
|
)
|
|
|
|
|
|
def get_hosting_module_with_routers() -> ModuleDefinition:
|
|
"""
|
|
Get hosting module with routers attached.
|
|
|
|
Attaches routers lazily to avoid circular imports during module initialization.
|
|
"""
|
|
hosting_module.admin_api_router = _get_admin_api_router()
|
|
hosting_module.admin_page_router = _get_admin_page_router()
|
|
hosting_module.public_page_router = _get_public_page_router()
|
|
return hosting_module
|
|
|
|
|
|
__all__ = ["hosting_module", "get_hosting_module_with_routers"]
|