fc / apps /core /protocols /organization_protocols.py
jun2024's picture
Upload 2241 files
b4f2238 verified
Raw History Blame Contribute Delete
3.27 kB
"""
组织相关 Protocol 接口定义
包含:IOrganizationService, ILawyerService, ILawFirmService
"""
from typing import Protocol
from apps.core.dto import AccountCredentialDTO, LawFirmDTO, LawyerDTO, TeamDTO
class IOrganizationService(Protocol):
"""组织服务接口,定义组织(律所、团队)相关的公共方法。"""
def get_law_firm(self, law_firm_id: int) -> LawFirmDTO | None: ...
def get_team(self, team_id: int) -> TeamDTO | None: ...
def get_lawyers_in_organization(self, organization_id: int) -> list[LawyerDTO]: ...
# Public credential/lawyer methods (preferred names for new callers).
def get_all_credentials(self) -> list[AccountCredentialDTO]: ...
def get_credential(self, credential_id: int) -> AccountCredentialDTO: ...
def get_credentials_by_site(self, site_name: str) -> list[AccountCredentialDTO]: ...
def get_credential_by_account(self, account: str, site_name: str) -> AccountCredentialDTO: ...
def update_login_success(self, credential_id: int) -> None: ...
def update_login_failure(self, credential_id: int) -> None: ...
def get_lawyer_by_id(self, lawyer_id: int) -> LawyerDTO | None: ...
def get_default_lawyer_id(self) -> int | None: ...
def has_credential_for_lawyer(self, lawyer_id: int, site_name: str) -> bool: ...
def get_credential_for_lawyer(self, lawyer_id: int, site_name: str) -> AccountCredentialDTO | None: ...
def list_sites_for_lawyer(self, lawyer_id: int) -> list[str]: ...
# Backward-compatible aliases kept for existing runtime callers.
def get_all_credentials_internal(self) -> list[AccountCredentialDTO]: ...
def get_credential_internal(self, credential_id: int) -> AccountCredentialDTO: ...
def get_credentials_by_site_internal(self, site_name: str) -> list[AccountCredentialDTO]: ...
def get_credential_by_account_internal(self, account: str, site_name: str) -> AccountCredentialDTO: ...
def update_login_success_internal(self, credential_id: int) -> None: ...
def update_login_failure_internal(self, credential_id: int) -> None: ...
def get_lawyer_by_id_internal(self, lawyer_id: int) -> LawyerDTO | None: ...
def get_default_lawyer_id_internal(self) -> int | None: ...
class ILawyerService(Protocol):
"""律师服务接口,供其他模块使用。"""
def get_lawyer(self, lawyer_id: int) -> LawyerDTO | None: ...
def get_lawyers_by_ids(self, lawyer_ids: list[int]) -> list[LawyerDTO]: ...
def get_team_members(self, team_id: int) -> list[LawyerDTO]: ...
# Public names for runtime callers.
def get_admin_lawyer(self) -> LawyerDTO | None: ...
def get_all_lawyer_names(self) -> list[str]: ...
def get_lawyer_model(self, lawyer_id: int) -> object | None: ...
# Backward-compatible aliases.
def get_admin_lawyer_internal(self) -> LawyerDTO | None: ...
def get_all_lawyer_names_internal(self) -> list[str]: ...
def get_lawyer_internal(self, lawyer_id: int) -> object | None: ...
class ILawFirmService(Protocol):
"""律所服务接口,供其他模块使用。"""
def get_lawfirm(self, lawfirm_id: int) -> LawFirmDTO | None: ...
def get_lawfirms_by_ids(self, lawfirm_ids: list[int]) -> list[LawFirmDTO]: ...