Improve backend
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user