30 lines
975 B
Python
30 lines
975 B
Python
from ...sync_system.strategy import DefaultSyncStrategy
|
|
from ...sync_system.config import StrategyConfig, OrphanAction, UpdateDirection
|
|
from schemas.company.company import CompanyResponse
|
|
|
|
|
|
class CompanySyncStrategy(DefaultSyncStrategy[CompanyResponse]):
|
|
"""
|
|
Company 同步策略
|
|
|
|
业务规则:
|
|
1. 使用 (code) 作为业务唯一键
|
|
2. 支持自动绑定
|
|
3. 默认配置为日常推送模式(本地创建推送到远程,不拉取远程孤儿)
|
|
|
|
schema 已在类定义中设置,禁止在初始化时传入其他 schema。
|
|
"""
|
|
|
|
# 类变量:schema 固定为 ContractResponse
|
|
schema = CompanyResponse
|
|
|
|
# 类变量:默认配置
|
|
default_config = StrategyConfig(
|
|
auto_bind=True,
|
|
auto_bind_fields=["code"],
|
|
depend_fields={},
|
|
local_orphan_action=OrphanAction.NONE,
|
|
remote_orphan_action=OrphanAction.CREATE_LOCAL,
|
|
update_direction=UpdateDirection.PULL,
|
|
)
|