- 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.
31 lines
596 B
Python
31 lines
596 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class SubscriptionCreate(BaseModel):
|
|
tenant_id: str
|
|
plan_id: str
|
|
limits: dict | None = None
|
|
status: str = "TRIAL"
|
|
|
|
|
|
class SubscriptionUpdate(BaseModel):
|
|
plan_id: str | None = None
|
|
limits: dict | None = None
|
|
status: str | None = None
|
|
ended_at: datetime | None = None
|
|
|
|
|
|
class SubscriptionResponse(BaseModel):
|
|
id: str
|
|
tenant_id: str
|
|
plan_id: str
|
|
limits: dict | None
|
|
status: str
|
|
started_at: datetime
|
|
ended_at: datetime | None
|
|
|
|
class Config:
|
|
from_attributes = True
|