refactor: modularize Telegram bot and add RabbitMQ client foundation
Build and Push Docker Images / build (push) Successful in 1m28s

- Рефакторинг Telegram бота на модульную структуру для удобства поддержки и расширения
- Создан общий RabbitMQ клиент для Flask и Telegram компонентов
- Подготовлена базовая архитектура для будущего масштабирования и новых функций

Signed-off-by: UdoChudo <stream@udochudo.ru>
This commit is contained in:
2025-06-16 09:08:46 +05:00
parent 52e31864b3
commit ccb47d527f
72 changed files with 1677 additions and 1675 deletions
+16 -7
View File
@@ -1,12 +1,21 @@
from flask import Blueprint, request, jsonify
from app.services.notifications_service import NotificationService
notification_bp = Blueprint('notification', __name__,url_prefix='/notifications')
import app.extensions.rabbitmq as rabbitmq_mod
import json
notification_bp = Blueprint('notification', __name__, url_prefix='/notification')
@notification_bp.route('/', methods=['POST'], strict_slashes=False)
def notification():
service = NotificationService()
def send_notification():
data = request.get_json()
result, status = service.process_notification(data)
return jsonify(result), status
if not data:
return jsonify({"error": "Empty JSON payload"}), 400
message = json.dumps(data)
client = rabbitmq_mod.get_rabbitmq_client()
try:
client.publish_message(message)
return jsonify({"status": "message queued"}), 200
except Exception as e:
return jsonify({"error": str(e)}), 500