feat(hosting): add HostWizard platform module and fix migration chain
Some checks failed
CI / pytest (push) Failing after 49m20s
CI / validate (push) Successful in 24s
CI / dependency-scanning (push) Successful in 33s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped
CI / ruff (push) Successful in 10s

- 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>
This commit is contained in:
2026-03-03 19:34:56 +01:00
parent 784bcb9d23
commit 8b147f53c6
46 changed files with 3907 additions and 13 deletions

View File

@@ -0,0 +1 @@
# app/modules/hosting/routes/pages/__init__.py

View File

@@ -0,0 +1,95 @@
# app/modules/hosting/routes/pages/admin.py
"""
Hosting Admin Page Routes (HTML rendering).
Admin pages for hosted site management:
- Dashboard - Overview with KPIs and charts
- Sites - Hosted site list with filters
- Site Detail - Single site view with tabs (overview, services, store link)
- Site New - Create new hosted site form
- Clients - All services overview with expiry warnings
"""
from fastapi import APIRouter, Depends, Path, Request
from fastapi.responses import HTMLResponse
from sqlalchemy.orm import Session
from app.api.deps import get_db, require_menu_access
from app.modules.core.utils.page_context import get_admin_context
from app.modules.enums import FrontendType
from app.modules.tenancy.models import User
from app.templates_config import templates
router = APIRouter()
@router.get("/hosting", response_class=HTMLResponse, include_in_schema=False)
async def admin_hosting_dashboard(
request: Request,
current_user: User = Depends(require_menu_access("hosting-dashboard", FrontendType.ADMIN)),
db: Session = Depends(get_db),
):
"""Render hosting dashboard page."""
return templates.TemplateResponse(
"hosting/admin/dashboard.html",
get_admin_context(request, db, current_user),
)
@router.get("/hosting/sites", response_class=HTMLResponse, include_in_schema=False)
async def admin_hosting_sites(
request: Request,
current_user: User = Depends(require_menu_access("hosting-sites", FrontendType.ADMIN)),
db: Session = Depends(get_db),
):
"""Render hosted sites list page."""
return templates.TemplateResponse(
"hosting/admin/sites.html",
get_admin_context(request, db, current_user),
)
@router.get("/hosting/sites/new", response_class=HTMLResponse, include_in_schema=False)
async def admin_hosting_site_new(
request: Request,
current_user: User = Depends(require_menu_access("hosting-sites", FrontendType.ADMIN)),
db: Session = Depends(get_db),
):
"""Render new hosted site form."""
return templates.TemplateResponse(
"hosting/admin/site-new.html",
get_admin_context(request, db, current_user),
)
@router.get(
"/hosting/sites/{site_id}",
response_class=HTMLResponse,
include_in_schema=False,
)
async def admin_hosting_site_detail(
request: Request,
site_id: int = Path(..., description="Hosted Site ID"),
current_user: User = Depends(require_menu_access("hosting-sites", FrontendType.ADMIN)),
db: Session = Depends(get_db),
):
"""Render hosted site detail page."""
context = get_admin_context(request, db, current_user)
context["site_id"] = site_id
return templates.TemplateResponse(
"hosting/admin/site-detail.html",
context,
)
@router.get("/hosting/clients", response_class=HTMLResponse, include_in_schema=False)
async def admin_hosting_clients(
request: Request,
current_user: User = Depends(require_menu_access("hosting-clients", FrontendType.ADMIN)),
db: Session = Depends(get_db),
):
"""Render all client services overview page."""
return templates.TemplateResponse(
"hosting/admin/clients.html",
get_admin_context(request, db, current_user),
)

View File

@@ -0,0 +1,46 @@
# app/modules/hosting/routes/pages/public.py
"""
Hosting Public Page Routes.
Public-facing routes for POC site viewing:
- POC Viewer - Shows the Store's storefront with a HostWizard preview banner
"""
from fastapi import APIRouter, Depends, Path, Request
from fastapi.responses import HTMLResponse
from sqlalchemy.orm import Session
from app.core.database import get_db
from app.templates_config import templates
router = APIRouter()
@router.get(
"/hosting/sites/{site_id}/preview",
response_class=HTMLResponse,
include_in_schema=False,
)
async def poc_site_viewer(
request: Request,
site_id: int = Path(..., description="Hosted Site ID"),
db: Session = Depends(get_db),
):
"""Render POC site viewer with HostWizard preview banner."""
from app.modules.hosting.models import HostedSite, HostedSiteStatus
site = db.query(HostedSite).filter(HostedSite.id == site_id).first()
# Only allow viewing for poc_ready or proposal_sent sites
if not site or site.status not in (HostedSiteStatus.POC_READY, HostedSiteStatus.PROPOSAL_SENT):
return HTMLResponse(content="<h1>Site not available for preview</h1>", status_code=404)
context = {
"request": request,
"site": site,
"store_url": f"/stores/{site.store.subdomain}" if site.store else "#",
}
return templates.TemplateResponse(
"hosting/public/poc-viewer.html",
context,
)