Багфикс

This commit is contained in:
urec56 2024-08-20 14:28:37 +04:00
parent 8eb21b6afe
commit 43ae5b9346

View file

@ -3,7 +3,8 @@ from urllib.parse import urljoin
from pydantic import ValidationError from pydantic import ValidationError
from app.chat.exceptions import UserDontHavePermissionException, UserCanNotReadThisChatException from app.chat.exceptions import UserDontHavePermissionException, UserCanNotReadThisChatException, \
UserAlreadyInChatException
from app.chat.shemas import SAllowedChats, SChangeData, SPinnedChats, SChat from app.chat.shemas import SAllowedChats, SChangeData, SPinnedChats, SChat
from app.config import settings from app.config import settings
from app.services.redis_service import RedisService from app.services.redis_service import RedisService
@ -50,7 +51,10 @@ 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) try:
await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id)
except UserAlreadyInChatException:
pass
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()