Replace team_id with account_id across all API endpoints (trees, categories, tags, steps, step_categories, admin, auth). Add new accounts and webhooks endpoints. Registration now atomically creates Account + Subscription, with account_invite_code bypassing the platform invite gate. Schemas updated for account_id/account_role. 82 tests passing including 18 new tests for accounts, subscriptions, and permissions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
from typing import Optional
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class SubscriptionResponse(BaseModel):
|
|
id: UUID
|
|
plan: str
|
|
status: str
|
|
billing_interval: Optional[str] = None
|
|
current_period_start: Optional[datetime] = None
|
|
current_period_end: Optional[datetime] = None
|
|
cancel_at_period_end: bool = False
|
|
stripe_subscription_id: Optional[str] = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class PlanLimitsResponse(BaseModel):
|
|
plan: str
|
|
max_trees: Optional[int] = None
|
|
max_sessions_per_month: Optional[int] = None
|
|
max_users: Optional[int] = None
|
|
custom_branding: bool = False
|
|
priority_support: bool = False
|
|
export_formats: list[str] = ["markdown", "text"]
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class UsageResponse(BaseModel):
|
|
tree_count: int
|
|
session_count_this_month: int
|
|
|
|
|
|
class SubscriptionDetails(BaseModel):
|
|
subscription: SubscriptionResponse
|
|
limits: PlanLimitsResponse
|
|
usage: UsageResponse
|