Silos/backend/app/schemas/tenant.py
AnuragJangid18 bf5cd44dc1 feat: implement workspace management and member invitations
- Added tenant API for managing workspaces, including listing, creating, and inviting members.
- Introduced new models for organizations, workspaces, and workspace memberships in the backend.
- Created frontend components for workspace administration, allowing users to manage workspaces and invite members.
- Updated document listing to support workspace-specific filtering.
- Implemented account settings page for user profile management and password changes.
- Added end-to-end tests for workspace administration and dashboard functionalities.
2026-10-23 01:19:11 +05:30

58 lines
1.2 KiB
Python

from datetime import datetime
from typing import Literal
from pydantic import BaseModel, EmailStr, Field
TenantRole = Literal["owner", "admin", "member", "viewer"]
class WorkspaceCreate(BaseModel):
organization_name: str = Field(min_length=2, max_length=160)
workspace_name: str = Field(min_length=2, max_length=160)
class WorkspaceResponse(BaseModel):
id: int
organization_id: int
organization_name: str
name: str
slug: str
role: TenantRole
created_at: datetime
class MemberResponse(BaseModel):
user_id: int
email: EmailStr
full_name: str
username: str
role: TenantRole
joined_at: datetime
class InvitationCreate(BaseModel):
email: EmailStr
role: Literal["admin", "member", "viewer"] = "member"
class InvitationResponse(BaseModel):
id: int
workspace_id: int
email: EmailStr
role: TenantRole
expires_at: datetime
accepted: bool
token: str | None = None
invite_url: str | None = None
class AuditEventResponse(BaseModel):
id: int
action: str
target: str
actor_id: int
created_at: datetime
class RoleUpdate(BaseModel):
role: Literal["admin", "member", "viewer"]