feat(hosting): add HostWizard platform module and fix migration chain
Some checks failed
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>
This commit is contained in:
32
app/modules/hosting/schemas/__init__.py
Normal file
32
app/modules/hosting/schemas/__init__.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# app/modules/hosting/schemas/__init__.py
|
||||
from app.modules.hosting.schemas.client_service import (
|
||||
ClientServiceCreate,
|
||||
ClientServiceDeleteResponse,
|
||||
ClientServiceResponse,
|
||||
ClientServiceUpdate,
|
||||
)
|
||||
from app.modules.hosting.schemas.hosted_site import (
|
||||
AcceptProposalRequest,
|
||||
GoLiveRequest,
|
||||
HostedSiteCreate,
|
||||
HostedSiteDetailResponse,
|
||||
HostedSiteListResponse,
|
||||
HostedSiteResponse,
|
||||
HostedSiteUpdate,
|
||||
SendProposalRequest,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"HostedSiteCreate",
|
||||
"HostedSiteUpdate",
|
||||
"HostedSiteResponse",
|
||||
"HostedSiteDetailResponse",
|
||||
"HostedSiteListResponse",
|
||||
"SendProposalRequest",
|
||||
"AcceptProposalRequest",
|
||||
"GoLiveRequest",
|
||||
"ClientServiceCreate",
|
||||
"ClientServiceUpdate",
|
||||
"ClientServiceResponse",
|
||||
"ClientServiceDeleteResponse",
|
||||
]
|
||||
80
app/modules/hosting/schemas/client_service.py
Normal file
80
app/modules/hosting/schemas/client_service.py
Normal file
@@ -0,0 +1,80 @@
|
||||
# app/modules/hosting/schemas/client_service.py
|
||||
"""Pydantic schemas for client service management."""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ClientServiceCreate(BaseModel):
|
||||
"""Schema for creating a client service."""
|
||||
|
||||
service_type: str = Field(..., pattern="^(domain|email|ssl|hosting|website_maintenance)$")
|
||||
name: str = Field(..., max_length=255)
|
||||
description: str | None = None
|
||||
billing_period: str | None = Field(None, pattern="^(monthly|annual|one_time)$")
|
||||
price_cents: int | None = None
|
||||
currency: str = Field("EUR", max_length=3)
|
||||
addon_product_id: int | None = None
|
||||
domain_name: str | None = Field(None, max_length=255)
|
||||
registrar: str | None = Field(None, max_length=100)
|
||||
mailbox_count: int | None = None
|
||||
expires_at: datetime | None = None
|
||||
period_start: datetime | None = None
|
||||
period_end: datetime | None = None
|
||||
auto_renew: bool = True
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class ClientServiceUpdate(BaseModel):
|
||||
"""Schema for updating a client service."""
|
||||
|
||||
name: str | None = Field(None, max_length=255)
|
||||
description: str | None = None
|
||||
status: str | None = Field(None, pattern="^(pending|active|suspended|expired|cancelled)$")
|
||||
billing_period: str | None = Field(None, pattern="^(monthly|annual|one_time)$")
|
||||
price_cents: int | None = None
|
||||
currency: str | None = Field(None, max_length=3)
|
||||
addon_product_id: int | None = None
|
||||
domain_name: str | None = Field(None, max_length=255)
|
||||
registrar: str | None = Field(None, max_length=100)
|
||||
mailbox_count: int | None = None
|
||||
expires_at: datetime | None = None
|
||||
period_start: datetime | None = None
|
||||
period_end: datetime | None = None
|
||||
auto_renew: bool | None = None
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class ClientServiceResponse(BaseModel):
|
||||
"""Schema for client service response."""
|
||||
|
||||
id: int
|
||||
hosted_site_id: int
|
||||
service_type: str
|
||||
name: str
|
||||
description: str | None = None
|
||||
status: str
|
||||
billing_period: str | None = None
|
||||
price_cents: int | None = None
|
||||
currency: str = "EUR"
|
||||
addon_product_id: int | None = None
|
||||
domain_name: str | None = None
|
||||
registrar: str | None = None
|
||||
mailbox_count: int | None = None
|
||||
expires_at: datetime | None = None
|
||||
period_start: datetime | None = None
|
||||
period_end: datetime | None = None
|
||||
auto_renew: bool = True
|
||||
notes: str | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ClientServiceDeleteResponse(BaseModel):
|
||||
"""Response for client service deletion."""
|
||||
|
||||
message: str
|
||||
101
app/modules/hosting/schemas/hosted_site.py
Normal file
101
app/modules/hosting/schemas/hosted_site.py
Normal file
@@ -0,0 +1,101 @@
|
||||
# app/modules/hosting/schemas/hosted_site.py
|
||||
"""Pydantic schemas for hosted site management."""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class HostedSiteCreate(BaseModel):
|
||||
"""Schema for creating a hosted site."""
|
||||
|
||||
business_name: str = Field(..., max_length=255)
|
||||
contact_name: str | None = Field(None, max_length=255)
|
||||
contact_email: str | None = Field(None, max_length=255)
|
||||
contact_phone: str | None = Field(None, max_length=50)
|
||||
internal_notes: str | None = None
|
||||
|
||||
|
||||
class HostedSiteUpdate(BaseModel):
|
||||
"""Schema for updating a hosted site."""
|
||||
|
||||
business_name: str | None = Field(None, max_length=255)
|
||||
contact_name: str | None = Field(None, max_length=255)
|
||||
contact_email: str | None = Field(None, max_length=255)
|
||||
contact_phone: str | None = Field(None, max_length=50)
|
||||
internal_notes: str | None = None
|
||||
|
||||
|
||||
class SendProposalRequest(BaseModel):
|
||||
"""Schema for sending a proposal."""
|
||||
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class AcceptProposalRequest(BaseModel):
|
||||
"""Schema for accepting a proposal."""
|
||||
|
||||
merchant_id: int | None = None
|
||||
|
||||
|
||||
class GoLiveRequest(BaseModel):
|
||||
"""Schema for going live with a domain."""
|
||||
|
||||
domain: str = Field(..., max_length=255)
|
||||
|
||||
|
||||
class HostedSiteResponse(BaseModel):
|
||||
"""Schema for hosted site response."""
|
||||
|
||||
id: int
|
||||
store_id: int
|
||||
prospect_id: int | None = None
|
||||
status: str
|
||||
business_name: str
|
||||
contact_name: str | None = None
|
||||
contact_email: str | None = None
|
||||
contact_phone: str | None = None
|
||||
proposal_sent_at: datetime | None = None
|
||||
proposal_accepted_at: datetime | None = None
|
||||
went_live_at: datetime | None = None
|
||||
proposal_notes: str | None = None
|
||||
live_domain: str | None = None
|
||||
internal_notes: str | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class HostedSiteDetailResponse(HostedSiteResponse):
|
||||
"""Full hosted site detail with services."""
|
||||
|
||||
client_services: list["ClientServiceResponse"] = []
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class HostedSiteListResponse(BaseModel):
|
||||
"""Paginated hosted site list response."""
|
||||
|
||||
items: list[HostedSiteResponse]
|
||||
total: int
|
||||
page: int
|
||||
per_page: int
|
||||
pages: int
|
||||
|
||||
|
||||
class HostedSiteDeleteResponse(BaseModel):
|
||||
"""Response for hosted site deletion."""
|
||||
|
||||
message: str
|
||||
|
||||
|
||||
# Forward references
|
||||
from app.modules.hosting.schemas.client_service import (
|
||||
ClientServiceResponse, # noqa: E402
|
||||
)
|
||||
|
||||
HostedSiteDetailResponse.model_rebuild()
|
||||
Reference in New Issue
Block a user