File size: 3,265 Bytes
b4f2238 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | """
组织相关 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]: ...
|