Files
Andrey Smakotin 4450e34497 feat(integrations): добавлен фундамент для интеграций с внешними сервисами
- Создано приложение integrations с базовой архитектурой
- BaseIntegration (абстрактная модель) для всех интеграций
- BaseIntegrationService (абстрактный сервисный класс)
- IntegrationConfig модель для тумблеров в system_settings
- Добавлена вкладка "Интеграции" в системные настройки
- Заготовка UI с тумблерами для включения интеграций

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:02:42 +03:00

49 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from abc import ABC, abstractmethod
from typing import Tuple
class BaseIntegrationService(ABC):
"""
Базовый класс для всех интеграционных сервисов.
Определяет общий интерфейс для работы с внешними API.
"""
def __init__(self, config):
"""
Args:
config: Экземпляр модели интеграции (наследник BaseIntegration)
"""
self.config = config
@abstractmethod
def test_connection(self) -> Tuple[bool, str]:
"""
Проверить соединение с внешним API.
Returns:
tuple: (success: bool, message: str)
"""
pass
@abstractmethod
def sync(self) -> Tuple[bool, str]:
"""
Выполнить основную операцию синхронизации.
Returns:
tuple: (success: bool, message: str)
"""
pass
def is_available(self) -> bool:
"""
Проверить, готова ли интеграция к использованию.
Returns:
bool: True если интеграция активна и настроена
"""
return (
self.config.is_active and
self.config.is_configured
)