diff --git a/app/dao/chat.py b/app/dao/chat.py index cd24531..8f1d839 100644 --- a/app/dao/chat.py +++ b/app/dao/chat.py @@ -58,7 +58,7 @@ class ChatDAO(BaseDAO): stmt = insert(UserChat).values(user_id=user_id, chat_id=chat_id) await self.session.execute(stmt) except IntegrityError: - raise UserAlreadyInChatException + pass async def change_data(self, chat_id: int, chat_name: str, avatar_image: HttpUrl) -> None: stmt = ( diff --git a/app/services/chat_service.py b/app/services/chat_service.py index 5fc3b6b..11f8e6d 100644 --- a/app/services/chat_service.py +++ b/app/services/chat_service.py @@ -51,10 +51,7 @@ class ChatService: avatar_image=user_chat_for.avatar_image ) await uow.chat.add_user_to_chat(user_id, chat_id) - try: - await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id) - except UserAlreadyInChatException: - pass + await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id) async with RedisService(is_raise=True) as redis: await redis.delete_key(key=f"user_allowed_chats: {user_id}") await uow.commit()