Add subcription feature
This commit is contained in:
@@ -19,6 +19,9 @@ class BakeryRegistration(BaseModel):
|
||||
business_type: str = Field(default="bakery")
|
||||
business_model: Optional[str] = Field(default="individual_bakery")
|
||||
coupon_code: Optional[str] = Field(None, max_length=50, description="Promotional coupon code")
|
||||
# Subscription linking fields (for new multi-phase registration architecture)
|
||||
subscription_id: Optional[str] = Field(None, description="Existing subscription ID to link to this tenant")
|
||||
link_existing_subscription: Optional[bool] = Field(False, description="Flag to link an existing subscription during tenant creation")
|
||||
|
||||
@field_validator('phone')
|
||||
@classmethod
|
||||
@@ -350,6 +353,29 @@ class BulkChildTenantsResponse(BaseModel):
|
||||
return str(v)
|
||||
return v
|
||||
|
||||
class TenantHierarchyResponse(BaseModel):
|
||||
"""Response schema for tenant hierarchy information"""
|
||||
tenant_id: str
|
||||
tenant_type: str = Field(..., description="Type: standalone, parent, or child")
|
||||
parent_tenant_id: Optional[str] = Field(None, description="Parent tenant ID if this is a child")
|
||||
hierarchy_path: Optional[str] = Field(None, description="Materialized path for hierarchy queries")
|
||||
child_count: int = Field(0, description="Number of child tenants (for parent tenants)")
|
||||
hierarchy_level: int = Field(0, description="Level in hierarchy: 0=parent, 1=child, 2=grandchild, etc.")
|
||||
|
||||
@field_validator('tenant_id', 'parent_tenant_id', mode='before')
|
||||
@classmethod
|
||||
def convert_uuid_to_string(cls, v):
|
||||
"""Convert UUID objects to strings for JSON serialization"""
|
||||
if v is None:
|
||||
return v
|
||||
if isinstance(v, UUID):
|
||||
return str(v)
|
||||
return v
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class TenantSearchRequest(BaseModel):
|
||||
"""Tenant search request schema"""
|
||||
query: Optional[str] = None
|
||||
|
||||
Reference in New Issue
Block a user