All checks were successful
CI / test (push) Successful in 19s
- add Saved Messages system chat with dedicated API - add public group/channel metadata and discover/join endpoints - add chat delete flow with for_all option and channel-wide delete - switch message actions to context menu and improve reply/forward visuals - improve microphone permission handling for voice recording
66 lines
1.4 KiB
Python
66 lines
1.4 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from app.chats.models import ChatMemberRole, ChatType
|
|
|
|
|
|
class ChatRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
type: ChatType
|
|
title: str | None = None
|
|
handle: str | None = None
|
|
description: str | None = None
|
|
is_public: bool = False
|
|
is_saved: bool = False
|
|
pinned_message_id: int | None = None
|
|
created_at: datetime
|
|
|
|
|
|
class ChatMemberRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
user_id: int
|
|
role: ChatMemberRole
|
|
joined_at: datetime
|
|
|
|
|
|
class ChatDetailRead(ChatRead):
|
|
members: list[ChatMemberRead]
|
|
|
|
|
|
class ChatCreateRequest(BaseModel):
|
|
type: ChatType
|
|
title: str | None = Field(default=None, max_length=255)
|
|
handle: str | None = Field(default=None, max_length=64)
|
|
description: str | None = Field(default=None, max_length=512)
|
|
is_public: bool = False
|
|
member_ids: list[int] = Field(default_factory=list)
|
|
|
|
|
|
class ChatMemberAddRequest(BaseModel):
|
|
user_id: int
|
|
|
|
|
|
class ChatMemberRoleUpdateRequest(BaseModel):
|
|
role: ChatMemberRole
|
|
|
|
|
|
class ChatTitleUpdateRequest(BaseModel):
|
|
title: str = Field(min_length=1, max_length=255)
|
|
|
|
|
|
class ChatPinMessageRequest(BaseModel):
|
|
message_id: int | None = None
|
|
|
|
|
|
class ChatDeleteRequest(BaseModel):
|
|
for_all: bool = False
|
|
|
|
|
|
class ChatDiscoverRead(ChatRead):
|
|
is_member: bool
|