video-accessibility/backend/app/models/organization.py
Vadym Samoilenko 31199f8705 chore: push all session changes — backend hardening, tests, apache config, deploy scripts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 15:52:14 +01:00

50 lines
1.3 KiB
Python

from datetime import datetime
from enum import Enum
from pydantic import BaseModel
class OrgRole(str, Enum):
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