Files
saas_backend/app/schemas/auth/tenant_schema.py
T

42 lines
1.2 KiB
Python

from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime
import uuid
class TenantBase(BaseModel):
tenant_name: str = Field(..., min_length=2, max_length=100)
tenant_domain: str = Field(..., min_length=3, max_length=255)
tenant_logo_url: Optional[str] = None
class ModuleEnvironmentAssignment(BaseModel):
module_id: uuid.UUID
environment_slug: str
class TenantCreate(TenantBase):
plan_id: uuid.UUID
module_environments: Optional[List[ModuleEnvironmentAssignment]] = []
default_environment_slug: str = "prod"
class TenantUpdate(BaseModel):
tenant_name: Optional[str] = Field(None, min_length=2, max_length=100)
tenant_domain: Optional[str] = Field(None, min_length=3, max_length=255)
tenant_logo_url: Optional[str] = None
is_active: Optional[bool] = None
plan_id: Optional[uuid.UUID] = None
class TenantResponse(TenantBase):
id: uuid.UUID
is_active: bool
plan_id: Optional[uuid.UUID] = None
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
class TenantPaginatedResponse(BaseModel):
items: List[TenantResponse]
total: int
page: int
page_size: int
total_pages: int