Add traslations
This commit is contained in:
@@ -204,7 +204,7 @@ class TenantStatsResponse(BaseModel):
|
||||
# ============================================================================
|
||||
|
||||
class ChildTenantCreate(BaseModel):
|
||||
"""Schema for creating a child tenant in enterprise hierarchy"""
|
||||
"""Schema for creating a child tenant in enterprise hierarchy - Updated to match tenant model"""
|
||||
name: str = Field(..., min_length=2, max_length=200, description="Child tenant name (e.g., 'Madrid - Salamanca')")
|
||||
city: str = Field(..., min_length=2, max_length=100, description="City where the outlet is located")
|
||||
zone: Optional[str] = Field(None, max_length=100, description="Zone or neighborhood")
|
||||
@@ -212,14 +212,24 @@ class ChildTenantCreate(BaseModel):
|
||||
postal_code: str = Field(..., pattern=r"^\d{5}$", description="5-digit postal code")
|
||||
location_code: str = Field(..., min_length=1, max_length=10, description="Short location code (e.g., MAD, BCN)")
|
||||
|
||||
# Optional coordinates (can be geocoded from address if not provided)
|
||||
# Coordinates (can be geocoded from address if not provided)
|
||||
latitude: Optional[float] = Field(None, ge=-90, le=90, description="Latitude coordinate")
|
||||
longitude: Optional[float] = Field(None, ge=-180, le=180, description="Longitude coordinate")
|
||||
|
||||
# Optional contact info (inherits from parent if not provided)
|
||||
# Contact info (inherits from parent if not provided)
|
||||
phone: Optional[str] = Field(None, min_length=9, max_length=20, description="Contact phone")
|
||||
email: Optional[str] = Field(None, description="Contact email")
|
||||
|
||||
# Business info
|
||||
business_type: Optional[str] = Field(None, max_length=100, description="Type of business")
|
||||
business_model: Optional[str] = Field(None, max_length=100, description="Business model")
|
||||
|
||||
# Timezone configuration
|
||||
timezone: Optional[str] = Field(None, max_length=50, description="Timezone for scheduling")
|
||||
|
||||
# Additional metadata
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata for the child tenant")
|
||||
|
||||
@field_validator('location_code')
|
||||
@classmethod
|
||||
def validate_location_code(cls, v):
|
||||
@@ -243,10 +253,42 @@ class ChildTenantCreate(BaseModel):
|
||||
raise ValueError('Invalid Spanish phone number')
|
||||
return v
|
||||
|
||||
@field_validator('business_type')
|
||||
@classmethod
|
||||
def validate_business_type(cls, v):
|
||||
"""Validate business type if provided"""
|
||||
if v is None:
|
||||
return v
|
||||
valid_types = ['bakery', 'coffee_shop', 'pastry_shop', 'restaurant']
|
||||
if v not in valid_types:
|
||||
raise ValueError(f'Business type must be one of: {valid_types}')
|
||||
return v
|
||||
|
||||
@field_validator('business_model')
|
||||
@classmethod
|
||||
def validate_business_model(cls, v):
|
||||
"""Validate business model if provided"""
|
||||
if v is None:
|
||||
return v
|
||||
valid_models = ['individual_bakery', 'central_baker_satellite', 'retail_bakery', 'hybrid_bakery']
|
||||
if v not in valid_models:
|
||||
raise ValueError(f'Business model must be one of: {valid_models}')
|
||||
return v
|
||||
|
||||
@field_validator('timezone')
|
||||
@classmethod
|
||||
def validate_timezone(cls, v):
|
||||
"""Validate timezone if provided"""
|
||||
if v is None:
|
||||
return v
|
||||
# Basic timezone validation - should match common timezone formats
|
||||
if not re.match(r'^[A-Za-z_+/]+$', v):
|
||||
raise ValueError('Invalid timezone format')
|
||||
return v
|
||||
|
||||
|
||||
class BulkChildTenantsCreate(BaseModel):
|
||||
"""Schema for bulk creating child tenants during onboarding"""
|
||||
parent_tenant_id: str = Field(..., description="ID of the parent (central baker) tenant")
|
||||
child_tenants: List[ChildTenantCreate] = Field(
|
||||
...,
|
||||
min_length=1,
|
||||
|
||||
Reference in New Issue
Block a user