Improve backend

This commit is contained in:
Urtzi Alfaro
2025-11-18 07:17:17 +01:00
parent d36f2ab9af
commit 5c45164c8e
61 changed files with 9846 additions and 495 deletions

View File

@@ -220,12 +220,10 @@ class MLInsightsSettings(BaseModel):
class NotificationSettings(BaseModel):
"""Notification and communication settings"""
# WhatsApp Configuration
# WhatsApp Configuration (Shared Account Model)
whatsapp_enabled: bool = Field(False, description="Enable WhatsApp notifications for this tenant")
whatsapp_phone_number_id: str = Field("", description="Meta WhatsApp Phone Number ID")
whatsapp_access_token: str = Field("", description="Meta WhatsApp Access Token (encrypted)")
whatsapp_business_account_id: str = Field("", description="Meta WhatsApp Business Account ID")
whatsapp_api_version: str = Field("v18.0", description="WhatsApp Cloud API version")
whatsapp_phone_number_id: str = Field("", description="Meta WhatsApp Phone Number ID (from shared master account)")
whatsapp_display_phone_number: str = Field("", description="Display format for UI (e.g., '+34 612 345 678')")
whatsapp_default_language: str = Field("es", description="Default language for WhatsApp templates")
# Email Configuration
@@ -262,13 +260,6 @@ class NotificationSettings(BaseModel):
raise ValueError("whatsapp_phone_number_id is required when WhatsApp is enabled")
return v
@validator('whatsapp_access_token')
def validate_access_token(cls, v, values):
"""Validate access token is provided if WhatsApp is enabled"""
if values.get('whatsapp_enabled') and not v:
raise ValueError("whatsapp_access_token is required when WhatsApp is enabled")
return v
# ================================================================
# REQUEST/RESPONSE SCHEMAS