File size: 3,768 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | """Django admin configuration."""
from __future__ import annotations
from typing import Any
from apps.core.interfaces import ServiceLocator
def get_contract_display_service() -> Any:
from apps.contracts.services import ContractDisplayService
if ServiceLocator._scope.get() is None:
return ContractDisplayService()
return ServiceLocator.get_or_create(
"contracts.contract_display_service",
lambda: ContractDisplayService(),
)
def get_contract_progress_service() -> Any:
from apps.contracts.services import ContractProgressService
if ServiceLocator._scope.get() is None:
return ContractProgressService()
return ServiceLocator.get_or_create(
"contracts.contract_progress_service",
lambda: ContractProgressService(),
)
def get_contract_admin_service() -> Any:
from apps.contracts.services import ContractAdminService
if ServiceLocator._scope.get() is None:
return ContractAdminService(
display_service=get_contract_display_service(),
progress_service=get_contract_progress_service(),
)
return ServiceLocator.get_or_create(
"contracts.contract_admin_service",
lambda: ContractAdminService(
display_service=get_contract_display_service(),
progress_service=get_contract_progress_service(),
),
)
def get_contract_batch_folder_binding_service() -> Any:
from apps.contracts.services import ContractBatchFolderBindingService
if ServiceLocator._scope.get() is None:
return ContractBatchFolderBindingService()
return ServiceLocator.get_or_create(
"contracts.contract_batch_folder_binding_service",
lambda: ContractBatchFolderBindingService(),
)
def get_contract_oa_sync_service() -> Any:
from apps.contracts.services import ContractOASyncService
if ServiceLocator._scope.get() is None:
return ContractOASyncService()
return ServiceLocator.get_or_create(
"contracts.contract_oa_sync_service",
lambda: ContractOASyncService(),
)
def get_contract_mutation_facade() -> Any:
from apps.contracts.services.contract.wiring import get_contract_mutation_facade as _get_contract_mutation_facade
return _get_contract_mutation_facade()
def get_contract_admin_action_service() -> Any:
from apps.contracts.services.admin_actions.wiring import build_contract_admin_action_service
if ServiceLocator._scope.get() is None:
return build_contract_admin_action_service()
return ServiceLocator.get_or_create(
"contracts.contract_admin_action_service",
build_contract_admin_action_service,
)
def get_contract_assignment_query_service() -> Any:
from apps.contracts.services.assignment.contract_assignment_query_service import ContractAssignmentQueryService
if ServiceLocator._scope.get() is None:
return ContractAssignmentQueryService()
return ServiceLocator.get_or_create(
"contracts.contract_assignment_query_service",
lambda: ContractAssignmentQueryService(),
)
def get_material_service() -> Any:
from apps.contracts.services.contract.integrations import MaterialService
if ServiceLocator._scope.get() is None:
return MaterialService()
return ServiceLocator.get_or_create(
"contracts.material_service",
lambda: MaterialService(),
)
def get_invoice_upload_service() -> Any:
from apps.contracts.services.contract.integrations import InvoiceUploadService
if ServiceLocator._scope.get() is None:
return InvoiceUploadService()
return ServiceLocator.get_or_create(
"contracts.invoice_upload_service",
lambda: InvoiceUploadService(),
)
|