feat: update all endpoints and schemas for account-based model
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>
This commit is contained in:
@@ -13,6 +13,7 @@ class UserBase(BaseModel):
|
||||
class UserCreate(UserBase):
|
||||
password: str = Field(..., min_length=10, description="Password must be at least 10 characters")
|
||||
invite_code: Optional[str] = Field(None, description="Invite code for registration (required when invite system is enabled)")
|
||||
account_invite_code: Optional[str] = Field(None, description="Account invite code to join an existing account")
|
||||
|
||||
@field_validator('password')
|
||||
@classmethod
|
||||
@@ -38,11 +39,11 @@ class UserLogin(BaseModel):
|
||||
|
||||
class UserResponse(UserBase):
|
||||
id: UUID
|
||||
role: str
|
||||
role: str = "engineer"
|
||||
account_id: UUID
|
||||
account_role: str
|
||||
is_super_admin: bool = False
|
||||
is_team_admin: bool = False
|
||||
is_active: bool = True
|
||||
team_id: Optional[UUID] = None
|
||||
created_at: datetime
|
||||
last_login: Optional[datetime] = None
|
||||
|
||||
@@ -54,5 +55,5 @@ class RoleUpdate(BaseModel):
|
||||
role: Literal["engineer", "viewer"]
|
||||
|
||||
|
||||
class TeamAdminUpdate(BaseModel):
|
||||
is_team_admin: bool
|
||||
class AccountRoleUpdate(BaseModel):
|
||||
account_role: str = Field(..., pattern="^(engineer|viewer)$")
|
||||
|
||||
Reference in New Issue
Block a user