Изменил создание чата
This commit is contained in:
parent
ff3d159e5f
commit
1f5fc664c3
2 changed files with 7 additions and 1 deletions
|
@ -14,6 +14,7 @@ from app.chat.shemas import (
|
|||
SPinnedChats,
|
||||
SPinnedMessages,
|
||||
SChangeData,
|
||||
SChatId,
|
||||
)
|
||||
from app.unit_of_work import UnitOfWork
|
||||
from app.users.dependencies import check_verificated_user_with_exc
|
||||
|
@ -37,7 +38,7 @@ async def get_all_chats(user: SUser = Depends(check_verificated_user_with_exc),
|
|||
@router.post(
|
||||
"/create_chat",
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
response_model=None,
|
||||
response_model=SChatId,
|
||||
)
|
||||
async def create_chat(
|
||||
user_to_exclude: int,
|
||||
|
@ -55,6 +56,7 @@ async def create_chat(
|
|||
await uow.chat.add_user_to_chat(user.id, chat_id)
|
||||
await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id)
|
||||
await uow.commit()
|
||||
return {"chat_id": chat_id}
|
||||
|
||||
|
||||
@router.post(
|
||||
|
|
|
@ -45,6 +45,10 @@ class SChangeData(BaseModel):
|
|||
avatar_image: HttpUrl
|
||||
|
||||
|
||||
class SChatId(BaseModel):
|
||||
chat_id: int
|
||||
|
||||
|
||||
class SAllowedChats(BaseModel):
|
||||
allowed_chats: list[SChat] | None
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue