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,20 @@
# app/modules/hosting/models/__init__.py
from app.modules.hosting.models.client_service import (
BillingPeriod,
ClientService,
ClientServiceStatus,
ServiceType,
)
from app.modules.hosting.models.hosted_site import (
HostedSite,
HostedSiteStatus,
)
__all__ = [
"HostedSite",
"HostedSiteStatus",
"ClientService",
"ServiceType",
"ClientServiceStatus",
"BillingPeriod",
]

View File

@@ -0,0 +1,97 @@
# app/modules/hosting/models/client_service.py
"""
ClientService model - operational tracking for services.
Complements billing StoreAddOn with operational details like domain expiry,
registrar info, and mailbox counts.
"""
import enum
from sqlalchemy import (
Boolean,
Column,
DateTime,
Enum,
ForeignKey,
Integer,
String,
Text,
)
from sqlalchemy.orm import relationship
from app.core.database import Base
from models.database.base import TimestampMixin
class ServiceType(str, enum.Enum):
DOMAIN = "domain"
EMAIL = "email"
SSL = "ssl"
HOSTING = "hosting"
WEBSITE_MAINTENANCE = "website_maintenance"
class ClientServiceStatus(str, enum.Enum):
PENDING = "pending"
ACTIVE = "active"
SUSPENDED = "suspended"
EXPIRED = "expired"
CANCELLED = "cancelled"
class BillingPeriod(str, enum.Enum):
MONTHLY = "monthly"
ANNUAL = "annual"
ONE_TIME = "one_time"
class ClientService(Base, TimestampMixin):
"""Represents an operational service for a hosted site."""
__tablename__ = "client_services"
id = Column(Integer, primary_key=True, index=True)
hosted_site_id = Column(
Integer,
ForeignKey("hosted_sites.id", ondelete="CASCADE"),
nullable=False,
index=True,
)
service_type = Column(Enum(ServiceType), nullable=False)
name = Column(String(255), nullable=False)
description = Column(Text, nullable=True)
status = Column(
Enum(ClientServiceStatus),
nullable=False,
default=ClientServiceStatus.PENDING,
)
# Billing
billing_period = Column(Enum(BillingPeriod), nullable=True)
price_cents = Column(Integer, nullable=True)
currency = Column(String(3), nullable=False, default="EUR")
addon_product_id = Column(
Integer,
ForeignKey("addon_products.id", ondelete="SET NULL"),
nullable=True,
)
# Domain-specific
domain_name = Column(String(255), nullable=True)
registrar = Column(String(100), nullable=True)
# Email-specific
mailbox_count = Column(Integer, nullable=True)
# Expiry and renewal
expires_at = Column(DateTime, nullable=True)
period_start = Column(DateTime, nullable=True)
period_end = Column(DateTime, nullable=True)
auto_renew = Column(Boolean, nullable=False, default=True)
# Notes
notes = Column(Text, nullable=True)
# Relationships
hosted_site = relationship("HostedSite", back_populates="client_services")

View File

@@ -0,0 +1,81 @@
# app/modules/hosting/models/hosted_site.py
"""
HostedSite model - links a Store to a Prospect and tracks the POC → live lifecycle.
Lifecycle: draft → poc_ready → proposal_sent → accepted → live → suspended | cancelled
"""
import enum
from sqlalchemy import Column, DateTime, Enum, ForeignKey, Integer, String, Text
from sqlalchemy.orm import relationship
from app.core.database import Base
from models.database.base import TimestampMixin
class HostedSiteStatus(str, enum.Enum):
DRAFT = "draft"
POC_READY = "poc_ready"
PROPOSAL_SENT = "proposal_sent"
ACCEPTED = "accepted"
LIVE = "live"
SUSPENDED = "suspended"
CANCELLED = "cancelled"
class HostedSite(Base, TimestampMixin):
"""Represents a hosted website linking a Store to a Prospect."""
__tablename__ = "hosted_sites"
id = Column(Integer, primary_key=True, index=True)
store_id = Column(
Integer,
ForeignKey("stores.id", ondelete="CASCADE"),
nullable=False,
unique=True,
)
prospect_id = Column(
Integer,
ForeignKey("prospects.id", ondelete="SET NULL"),
nullable=True,
)
status = Column(
Enum(HostedSiteStatus),
nullable=False,
default=HostedSiteStatus.DRAFT,
)
# Denormalized for dashboard display
business_name = Column(String(255), nullable=False)
contact_name = Column(String(255), nullable=True)
contact_email = Column(String(255), nullable=True)
contact_phone = Column(String(50), nullable=True)
# Lifecycle timestamps
proposal_sent_at = Column(DateTime, nullable=True)
proposal_accepted_at = Column(DateTime, nullable=True)
went_live_at = Column(DateTime, nullable=True)
# Proposal
proposal_notes = Column(Text, nullable=True)
# Denormalized from StoreDomain
live_domain = Column(String(255), nullable=True, unique=True)
# Internal notes
internal_notes = Column(Text, nullable=True)
# Relationships
store = relationship("Store", backref="hosted_site", uselist=False)
prospect = relationship("Prospect", backref="hosted_sites")
client_services = relationship(
"ClientService",
back_populates="hosted_site",
cascade="all, delete-orphan",
)
@property
def display_name(self) -> str:
return self.business_name or f"Site #{self.id}"