Багфикс

This commit is contained in:
urec56 2024-08-20 14:47:27 +04:00
parent 4acf393d2b
commit 93658a0aa3
3 changed files with 6 additions and 6 deletions

View file

@ -58,7 +58,7 @@ class ChatDAO(BaseDAO):
stmt = insert(UserChat).values(user_id=user_id, chat_id=chat_id) stmt = insert(UserChat).values(user_id=user_id, chat_id=chat_id)
await self.session.execute(stmt) await self.session.execute(stmt)
except IntegrityError: except IntegrityError:
pass raise UserAlreadyInChatException
async def change_data(self, chat_id: int, chat_name: str, avatar_image: HttpUrl) -> None: async def change_data(self, chat_id: int, chat_name: str, avatar_image: HttpUrl) -> None:
stmt = ( stmt = (

View file

@ -51,7 +51,8 @@ class ChatService:
avatar_image=user_chat_for.avatar_image avatar_image=user_chat_for.avatar_image
) )
await uow.chat.add_user_to_chat(user_id, chat_id) await uow.chat.add_user_to_chat(user_id, chat_id)
# await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id) if user_id != settings.ADMIN_USER_ID:
await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id)
async with RedisService(is_raise=True) as redis: async with RedisService(is_raise=True) as redis:
await redis.delete_key(key=f"user_allowed_chats: {user_id}") await redis.delete_key(key=f"user_allowed_chats: {user_id}")
await uow.commit() await uow.commit()

View file

@ -24,10 +24,9 @@ class UnitOfWork:
await self.rollback() await self.rollback()
await self.session.close() await self.session.close()
except SQLAlchemyError: except SQLAlchemyError:
pass raise BlackPhoenixException
# raise BlackPhoenixException if isinstance(exc, SQLAlchemyError):
# if isinstance(exc, SQLAlchemyError): raise BlackPhoenixException
# raise BlackPhoenixException
async def commit(self): async def commit(self):
await self.session.commit() await self.session.commit()