Files
orion/app/modules/prospecting/schemas/campaign.py
Samir Boulahtit 6d6eba75bf
Some checks failed
CI / pytest (push) Failing after 48m31s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped
CI / ruff (push) Successful in 11s
CI / validate (push) Successful in 23s
CI / dependency-scanning (push) Successful in 28s
feat(prospecting): add complete prospecting module for lead discovery and scoring
Migrates scanning pipeline from marketing-.lu-domains app into Orion module.
Supports digital (domain scan) and offline (manual capture) lead channels
with enrichment, scoring, campaign management, and interaction tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 00:59:47 +01:00

104 lines
2.5 KiB
Python

# app/modules/prospecting/schemas/campaign.py
"""Pydantic schemas for campaign management."""
from datetime import datetime
from pydantic import BaseModel, Field
class CampaignTemplateCreate(BaseModel):
"""Schema for creating a campaign template."""
name: str = Field(..., max_length=255)
lead_type: str = Field(
...,
pattern="^(no_website|bad_website|gmail_only|security_issues|performance_issues|outdated_cms|general)$",
)
channel: str = Field("email", pattern="^(email|letter|phone_script)$")
language: str = Field("fr", max_length=5)
subject_template: str | None = Field(None, max_length=500)
body_template: str = Field(...)
is_active: bool = True
class CampaignTemplateUpdate(BaseModel):
"""Schema for updating a campaign template."""
name: str | None = Field(None, max_length=255)
lead_type: str | None = None
channel: str | None = None
language: str | None = Field(None, max_length=5)
subject_template: str | None = None
body_template: str | None = None
is_active: bool | None = None
class CampaignTemplateResponse(BaseModel):
"""Schema for campaign template response."""
id: int
name: str
lead_type: str
channel: str
language: str
subject_template: str | None = None
body_template: str
is_active: bool
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
class CampaignSendCreate(BaseModel):
"""Schema for sending a campaign."""
template_id: int
prospect_ids: list[int] = Field(..., min_length=1)
class CampaignPreviewRequest(BaseModel):
"""Schema for previewing a rendered campaign."""
template_id: int
prospect_id: int
class CampaignPreviewResponse(BaseModel):
"""Schema for campaign preview response."""
subject: str | None = None
body: str
class CampaignSendResponse(BaseModel):
"""Schema for campaign send record response."""
id: int
template_id: int | None = None
prospect_id: int
channel: str
rendered_subject: str | None = None
rendered_body: str | None = None
status: str
sent_at: datetime | None = None
sent_by_user_id: int | None = None
created_at: datetime
class Config:
from_attributes = True
class CampaignSendListResponse(BaseModel):
"""List of campaign sends."""
items: list[CampaignSendResponse]
total: int
class CampaignTemplateDeleteResponse(BaseModel):
"""Response for template deletion."""
message: str