refactor: reorganize backend module boundaries

This commit is contained in:
jxxghp
2026-08-14 19:53:33 +08:00
parent fe0b444ceb
commit 369d7d6448
584 changed files with 2423 additions and 2275 deletions

View File

@@ -0,0 +1,34 @@
from typing import Optional
from app.runtime.extensions.service_registry import ServiceBaseHelper
from app.schemas import NotificationConf, ServiceInfo
from app.schemas.types import ModuleType, SystemConfigKey
class NotificationHelper(ServiceBaseHelper[NotificationConf]):
"""提供按持久化配置发现通知服务的能力。"""
def __init__(self):
"""绑定通知配置和通知模块类型。"""
super().__init__(
config_key=SystemConfigKey.Notifications,
conf_type=NotificationConf,
module_type=ModuleType.Notification,
)
def is_notification(
self,
service_type: Optional[str] = None,
service: Optional[ServiceInfo] = None,
name: Optional[str] = None,
) -> bool:
"""
判断通知服务是否属于指定类型。
:param service_type: 消息通知服务的类型名称
:param service: 要判断的服务信息
:param name: 未传入服务信息时用于查询的服务名称
:return: 服务存在且类型匹配时返回 True
"""
service = service or self.get_service(name=name)
return bool(service and service.type == service_type)