- Added subscription_service.py for managing subscriptions with functions to create, read, update, and delete subscriptions. - Added tenant_service.py for managing tenants with functions to create, read, update, delete tenants, and assign users to tenants. - Added user_service.py for managing users with functions to create, read, update, and delete users. - Created tests for business types, plans, subscriptions, tenants, and users, ensuring proper functionality and error handling. - Implemented pagination in user listing and included user profiles in responses. - Established fixtures for database setup and teardown in tests.
40 lines
794 B
Python
40 lines
794 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class TenantCreate(BaseModel):
|
|
name: str
|
|
slug: str
|
|
business_type_id: str
|
|
phone: str | None = None
|
|
address: str | None = None
|
|
email: str | None = None
|
|
plan_id: str
|
|
limits: dict | None = None
|
|
|
|
|
|
class TenantUpdate(BaseModel):
|
|
name: str | None = None
|
|
slug: str | None = None
|
|
business_type_id: str | None = None
|
|
phone: str | None = None
|
|
address: str | None = None
|
|
email: str | None = None
|
|
status: str | None = None
|
|
|
|
|
|
class TenantResponse(BaseModel):
|
|
id: str
|
|
name: str
|
|
slug: str
|
|
business_type_id: str
|
|
phone: str | None
|
|
address: str | None
|
|
email: str | None
|
|
status: str
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|