Source code for cadrumo.application.filing.draft_review_ports
"""Application-owned capabilities for draft approval and stale detection.The draft-review lifecycle fingerprints several persisted authorities. Thismodule keeps that use case independent from the encrypted-storage adapters andgives composition roots one cohesive bundle to bind for a profile bucket.Core types::class:`~cadrumo.domain.filing.schema.ModeloDraft`."""from__future__importannotationsfromcollections.abcimportIterator,MappingfromdataclassesimportdataclassfrompathlibimportPathfromtypingimportProtocolfrom...domain.filing.schemaimportModeloDraftfrom...domain.invoices.protocolsimportInvoiceCatalogueRepositoryProtocolfrom...domain.transactions.protocolsimportTransactionCatalogueRepositoryProtocolfrom..calculations.observations_repositoryimportCalculationObservationRepositoryProtocol
[docs]classDraftReviewProfileRepositoryProtocol(Protocol):"""Read-only profile projection used by the approval-basis fingerprint."""
[docs]defload_path_values(self,*,bucket_id:str)->Mapping[str,str]|None:"""Return canonical profile path values, or ``None`` when absent."""...
[docs]classDraftReviewDraftRepositoryProtocol(Protocol):"""Read-only draft store capability used by the review queue."""
[docs]defiter_drafts(self)->Iterator[ModeloDraft]:"""Yield the bucket's persisted drafts."""...
[docs]defenvelope_path_for(self,identifier:str)->Path:"""Return the non-secret logical path marker for one draft."""...
[docs]@dataclass(frozen=True,slots=True)classDraftReviewPorts:"""Required persisted authorities for one draft-review invocation."""transaction_repository:TransactionCatalogueRepositoryProtocolinvoice_repository:InvoiceCatalogueRepositoryProtocolobservation_repository:CalculationObservationRepositoryProtocolprofile_repository:DraftReviewProfileRepositoryProtocoldraft_repository:DraftReviewDraftRepositoryProtocol
[docs]classDraftReviewPortsFactory(Protocol):"""Construct the draft-review authorities for one profile bucket."""def__call__(self,*,bucket_id:str)->DraftReviewPorts:"""Return all capabilities required for ``bucket_id``."""...