Files
orion/app/modules/hosting/definition.py
Samir Boulahtit 45260b6b82
Some checks failed
CI / ruff (push) Successful in 11s
CI / docs (push) Has been cancelled
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled
feat(admin): separate platform CRUD from CMS, add entity selector macro
- Move platforms menu from CMS to Platform Admin section with create/edit
- Add platform create page, API endpoint, and service method
- Remove CMS-specific content from platform list and detail pages
- Create shared entity_selector + entity_selected_badge Jinja macros
- Create entity-selector.js generalizing store-selector.js for any entity
- Add Tom Select merchant filter to stores page with localStorage persistence
- Migrate store-products page to use shared macros (remove 53 lines of duped CSS)
- Fix broken icons: puzzle→puzzle-piece, building-storefront→store, language→translate, server→cube

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 22:40:15 +01:00

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="cube",
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"]