diff --git a/repositories/user.py b/repositories/user.py index b72e832..d7d09e5 100644 --- a/repositories/user.py +++ b/repositories/user.py @@ -25,7 +25,7 @@ async def get_by_tgid(user_dto: UserDTO) -> UserDTO | None: @staticmethod async def update(user_dto: UserDTO) -> None: - user_dto_dict = user_dto.__dict__ + user_dto_dict = user_dto.model_dump() none_keys = [k for k, v in user_dto_dict.items() if v is None] for k in none_keys: user_dto_dict.pop(k) diff --git a/services/cart.py b/services/cart.py index 8a483e4..52cddb0 100644 --- a/services/cart.py +++ b/services/cart.py @@ -149,8 +149,8 @@ async def buy_processing(callback: CallbackQuery) -> tuple[str, InlineKeyboardBu await CartItemRepository.remove_from_cart(cart_item.id) sold_items.append(cart_item) msg += MessageService.create_message_with_bought_items(purchased_items) - user.consume_records = user.consume_records + cart_total - await UserRepository.update(user) + user.consume_records = user.consume_records + cart_total + await UserRepository.update(user) await NotificationService.new_buy(sold_items, user) return msg, kb_builder elif unpacked_cb.confirmation is False: