Spaces:
Running
Running
axeronis commited on
Commit ·
05ec6f9
1
Parent(s): 5da1554
fix: Temporarily disable WhatsApp QR endpoints to fix deployment
Browse files- backend/app/api/channels.py +100 -97
backend/app/api/channels.py
CHANGED
|
@@ -12,7 +12,8 @@ from app.core.config import settings
|
|
| 12 |
from app.core.logging import get_logger
|
| 13 |
from app.models import User
|
| 14 |
from app.api.deps import get_current_user
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
logger = get_logger(__name__)
|
| 18 |
router = APIRouter(prefix="/channels", tags=["Channels"])
|
|
@@ -577,99 +578,101 @@ async def disconnect_linkedin(
|
|
| 577 |
|
| 578 |
|
| 579 |
# ==================== WhatsApp QR (Grey API) ====================
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
|
|
|
|
|
|
|
|
| 12 |
from app.core.logging import get_logger
|
| 13 |
from app.models import User
|
| 14 |
from app.api.deps import get_current_user
|
| 15 |
+
# TODO: Uncomment when WhatsApp QR is ready
|
| 16 |
+
# from app.services.whatsapp_qr import whatsapp_qr_service
|
| 17 |
|
| 18 |
logger = get_logger(__name__)
|
| 19 |
router = APIRouter(prefix="/channels", tags=["Channels"])
|
|
|
|
| 578 |
|
| 579 |
|
| 580 |
# ==================== WhatsApp QR (Grey API) ====================
|
| 581 |
+
# TODO: Temporarily disabled due to deployment issues
|
| 582 |
+
# Will be re-enabled once qrcode dependency is properly installed
|
| 583 |
+
|
| 584 |
+
# @router.post("/whatsapp/qr/generate")
|
| 585 |
+
# async def generate_whatsapp_qr(
|
| 586 |
+
# current_user: User = Depends(get_current_user),
|
| 587 |
+
# session = Depends(get_session)
|
| 588 |
+
# ):
|
| 589 |
+
# """
|
| 590 |
+
# Генерация QR-кода для подключения WhatsApp через серый API
|
| 591 |
+
# """
|
| 592 |
+
# try:
|
| 593 |
+
# tenant_id = str(current_user.tenant_id)
|
| 594 |
+
#
|
| 595 |
+
# # Генерируем QR код
|
| 596 |
+
# qr_data = await whatsapp_qr_service.generate_qr(tenant_id)
|
| 597 |
+
#
|
| 598 |
+
# return {
|
| 599 |
+
# "ok": True,
|
| 600 |
+
# "qr_code": qr_data,
|
| 601 |
+
# "message": "QR-код сгенерирован. Отсканируйте его в WhatsApp."
|
| 602 |
+
# }
|
| 603 |
+
#
|
| 604 |
+
# except Exception as e:
|
| 605 |
+
# logger.error(
|
| 606 |
+
# "Failed to generate WhatsApp QR",
|
| 607 |
+
# error=str(e),
|
| 608 |
+
# exc_info=True
|
| 609 |
+
# )
|
| 610 |
+
# raise HTTPException(
|
| 611 |
+
# status_code=500,
|
| 612 |
+
# detail=f"Ошибка генерации QR: {str(e)}"
|
| 613 |
+
# )
|
| 614 |
+
|
| 615 |
+
|
| 616 |
+
# @router.get("/whatsapp/qr/status")
|
| 617 |
+
# async def get_whatsapp_qr_status(
|
| 618 |
+
# current_user: User = Depends(get_current_user),
|
| 619 |
+
# session = Depends(get_session)
|
| 620 |
+
# ):
|
| 621 |
+
# """
|
| 622 |
+
# Проверка статуса WhatsApp QR подключения
|
| 623 |
+
# """
|
| 624 |
+
# try:
|
| 625 |
+
# tenant_id = str(current_user.tenant_id)
|
| 626 |
+
#
|
| 627 |
+
# # Проверяем статус сессии
|
| 628 |
+
# status = await whatsapp_qr_service.check_session(tenant_id)
|
| 629 |
+
#
|
| 630 |
+
# return {
|
| 631 |
+
# "ok": True,
|
| 632 |
+
# "connected": status["connected"],
|
| 633 |
+
# "status": status["status"],
|
| 634 |
+
# "phone": status.get("phone")
|
| 635 |
+
# }
|
| 636 |
+
#
|
| 637 |
+
# except Exception as e:
|
| 638 |
+
# logger.error(
|
| 639 |
+
# "Failed to check WhatsApp QR status",
|
| 640 |
+
# error=str(e),
|
| 641 |
+
# exc_info=True
|
| 642 |
+
# )
|
| 643 |
+
# raise HTTPException(
|
| 644 |
+
# status_code=500,
|
| 645 |
+
# detail=f"Ошибка проверки статуса: {str(e)}"
|
| 646 |
+
# )
|
| 647 |
+
|
| 648 |
+
|
| 649 |
+
# @router.post("/whatsapp/qr/disconnect")
|
| 650 |
+
# async def disconnect_whatsapp_qr(
|
| 651 |
+
# current_user: User = Depends(get_current_user),
|
| 652 |
+
# session = Depends(get_session)
|
| 653 |
+
# ):
|
| 654 |
+
# """
|
| 655 |
+
# Отключение WhatsApp QR сессии
|
| 656 |
+
# """
|
| 657 |
+
# try:
|
| 658 |
+
# tenant_id = str(current_user.tenant_id)
|
| 659 |
+
#
|
| 660 |
+
# # Отключаем сессию
|
| 661 |
+
# await whatsapp_qr_service.disconnect(tenant_id)
|
| 662 |
+
#
|
| 663 |
+
# return {
|
| 664 |
+
# "ok": True,
|
| 665 |
+
# "status": "disconnected",
|
| 666 |
+
# "message": "WhatsApp QR успешно отключен"
|
| 667 |
+
# }
|
| 668 |
+
#
|
| 669 |
+
# except Exception as e:
|
| 670 |
+
# logger.error(
|
| 671 |
+
# "Failed to disconnect WhatsApp QR",
|
| 672 |
+
# error=str(e),
|
| 673 |
+
# exc_info=True
|
| 674 |
+
# )
|
| 675 |
+
# raise HTTPException(
|
| 676 |
+
# status_code=500,
|
| 677 |
+
# detail=f"Ошибка отключения: {str(e)}"
|
| 678 |
+
# )
|