chats: add chat avatars and profile view-only modal
All checks were successful
CI / test (push) Successful in 23s
All checks were successful
CI / test (push) Successful in 23s
This commit is contained in:
@@ -15,6 +15,7 @@ from app.chats.schemas import (
|
||||
ChatNotificationSettingsRead,
|
||||
ChatNotificationSettingsUpdate,
|
||||
ChatPinMessageRequest,
|
||||
ChatProfileUpdateRequest,
|
||||
ChatRead,
|
||||
ChatTitleUpdateRequest,
|
||||
)
|
||||
@@ -40,6 +41,7 @@ from app.chats.service import (
|
||||
set_chat_pinned_for_user,
|
||||
update_chat_member_role_for_user,
|
||||
update_chat_notification_settings_for_user,
|
||||
update_chat_profile_for_user,
|
||||
update_chat_title_for_user,
|
||||
)
|
||||
from app.database.session import get_db
|
||||
@@ -139,6 +141,18 @@ async def update_chat_title(
|
||||
return await serialize_chat_for_user(db, user_id=current_user.id, chat=chat)
|
||||
|
||||
|
||||
@router.patch("/{chat_id}/profile", response_model=ChatRead)
|
||||
async def update_chat_profile(
|
||||
chat_id: int,
|
||||
payload: ChatProfileUpdateRequest,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ChatRead:
|
||||
chat = await update_chat_profile_for_user(db, chat_id=chat_id, user_id=current_user.id, payload=payload)
|
||||
await realtime_gateway.publish_chat_updated(chat_id=chat.id)
|
||||
return await serialize_chat_for_user(db, user_id=current_user.id, chat=chat)
|
||||
|
||||
|
||||
@router.get("/{chat_id}/members", response_model=list[ChatMemberRead])
|
||||
async def list_chat_members(
|
||||
chat_id: int,
|
||||
|
||||
Reference in New Issue
Block a user