mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-14 05:40:16 +02:00
* Backend changes for pagination hook + Paginated users table * Frontend changes for pagination hook * Fix invited users endpoint * Fix layout shift & add enter to submit user invites * mypy * Cleanup * Resolve PR concerns & remove UserStatus * Fix errors --------- Co-authored-by: hagen-danswer <hagen@danswer.ai>
56 lines
999 B
Python
56 lines
999 B
Python
from typing import Generic
|
|
from typing import Optional
|
|
from typing import TypeVar
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from onyx.auth.schemas import UserRole
|
|
from onyx.db.models import User
|
|
|
|
|
|
DataT = TypeVar("DataT")
|
|
|
|
|
|
class StatusResponse(BaseModel, Generic[DataT]):
|
|
success: bool
|
|
message: Optional[str] = None
|
|
data: Optional[DataT] = None
|
|
|
|
|
|
class ApiKey(BaseModel):
|
|
api_key: str
|
|
|
|
|
|
class IdReturn(BaseModel):
|
|
id: int
|
|
|
|
|
|
class MinimalUserSnapshot(BaseModel):
|
|
id: UUID
|
|
email: str
|
|
|
|
|
|
class FullUserSnapshot(BaseModel):
|
|
id: UUID
|
|
email: str
|
|
role: UserRole
|
|
is_active: bool
|
|
|
|
@classmethod
|
|
def from_user_model(cls, user: User) -> "FullUserSnapshot":
|
|
return cls(
|
|
id=user.id,
|
|
email=user.email,
|
|
role=user.role,
|
|
is_active=user.is_active,
|
|
)
|
|
|
|
|
|
class InvitedUserSnapshot(BaseModel):
|
|
email: str
|
|
|
|
|
|
class DisplayPriorityRequest(BaseModel):
|
|
display_priority_map: dict[int, int]
|