Files
orion/app/modules/hosting/models/client_service.py
Samir Boulahtit 8b147f53c6
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
feat(hosting): add HostWizard platform module and fix migration chain
- 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>
2026-03-03 19:34:56 +01:00

98 lines
2.4 KiB
Python

# 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")