- B904 (55): add `from err` / `from None` to raise-in-except across 13 files - F821 (1): add missing HTTPException import in routes_language_qc.py - F841 (7): remove unused variable assignments (current_user, job_title, tts_provider, etc.) - W293 (13): strip trailing whitespace from blank lines - C416 (4): rewrite unnecessary dict comprehensions as dict() - C401 (1): rewrite unnecessary generator as set comprehension - E701 (4): split multi-statement lines in cost_tracker.py - E741 (1): rename ambiguous `l` to `lang` in cloud_run_dispatch.py - B007 (4): prefix unused loop variables with _ in tts.py, video_renderer.py - I001 (1): sort imports in tasks/__init__.py (move stdlib to top) - E402 (3): move threading/time/signals imports to top of tasks/__init__.py - UP042 (9): replace (str, Enum) with StrEnum in all model/schema enums Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
from datetime import datetime
|
|
from enum import StrEnum
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class OrgRole(StrEnum):
|
|
OWNER = "owner"
|
|
ADMIN = "admin"
|
|
MANAGER = "manager"
|
|
MEMBER = "member"
|
|
VIEWER = "viewer"
|
|
|
|
@classmethod
|
|
def _ordering(cls) -> list:
|
|
return [cls.VIEWER, cls.MEMBER, cls.MANAGER, cls.ADMIN, cls.OWNER]
|
|
|
|
def __ge__(self, other: "OrgRole") -> bool:
|
|
return self._ordering().index(self) >= self._ordering().index(other)
|
|
|
|
def __gt__(self, other: "OrgRole") -> bool:
|
|
return self._ordering().index(self) > self._ordering().index(other)
|
|
|
|
def __le__(self, other: "OrgRole") -> bool:
|
|
return self._ordering().index(self) <= self._ordering().index(other)
|
|
|
|
def __lt__(self, other: "OrgRole") -> bool:
|
|
return self._ordering().index(self) < self._ordering().index(other)
|
|
|
|
|
|
class Organization(BaseModel):
|
|
id: str | None = None
|
|
name: str
|
|
slug: str
|
|
is_active: bool = True
|
|
plan: str = "standard"
|
|
created_at: datetime | None = None
|
|
updated_at: datetime | None = None
|
|
|
|
|
|
class OrganizationCreate(BaseModel):
|
|
name: str
|
|
slug: str
|
|
|
|
|
|
class OrganizationUpdate(BaseModel):
|
|
name: str | None = None
|
|
slug: str | None = None
|
|
is_active: bool | None = None
|
|
plan: str | None = None
|