diff --git a/app/routes/user_routes.py b/app/routes/user_routes.py index 060ac2d..c5ab3ae 100644 --- a/app/routes/user_routes.py +++ b/app/routes/user_routes.py @@ -98,37 +98,6 @@ async def get_user( logger.exception(f"Неожиданная ошибка при получении пользователя с telegram_id {telegram_id}: {e}") raise HTTPException(status_code=500, detail=str(e)) - - -@router.post("/user/{telegram_id}/balance/{amount}", summary="Обновить баланс") -async def update_balance( - telegram_id: int, - amount: float, - db_manager: DatabaseManager = Depends(get_database_manager) -): - """ - Обновляет баланс пользователя. - """ - logger.info(f"Получен запрос на обновление баланса: telegram_id={telegram_id}, amount={amount}") - try: - result = await db_manager.update_balance(telegram_id, amount) - if result == "ERROR": - logger.error(f"Ошибка обновления баланса для пользователя {telegram_id}") - raise HTTPException(status_code=500, detail="Failed to update balance") - - logger.info(f"Баланс пользователя {telegram_id} успешно обновлен на {amount}") - return {"message": "Balance updated successfully"} - except HTTPException as http_ex: - logger.warning(f"HTTP ошибка: {http_ex.detail}") - raise http_ex - except SQLAlchemyError as db_ex: - logger.error(f"Ошибка базы данных при обновлении баланса пользователя {telegram_id}: {db_ex}") - raise HTTPException(status_code=500, detail="Database error") - except Exception as e: - logger.exception(f"Неожиданная ошибка при обновлении баланса пользователя {telegram_id}: {e}") - raise HTTPException(status_code=500, detail=str(e)) - - @router.get("/user/{telegram_id}/transactions", summary="Последние транзакции пользователя") async def last_transactions( telegram_id: int,