Source code for cadrumo.domain.modelos.filing_repository
"""Domain-side filing-record catalogue port surface.This module owns the pure filing-record catalogue vocabulary: the:class:`ModeloRecordPersistenceError` raised at the storage boundary, the:func:`upsert_filing_record` pure mutator, and the namespace / schema-versionconstants that name the persisted envelope contract. The concrete encryptedSQL repository lives in the persistence adapter:class:`~cadrumo.adapters.persistence.profile.modelos_filing.ModeloRecordCatalogueRepository`,behind the read-side:class:`~ModeloRecordCatalogueRepositoryProtocol`; thedomain package depends only on the structural port."""from__future__importannotationsfrom.errorsimportModeloErrorfrom.filing_recordimportModeloRecord,ModeloRecordCatalogue
[docs]classModeloRecordPersistenceError(ModeloError):"""Raised when the filing-record catalogue cannot be persisted or loaded. This wraps storage-boundary failures from :class:`~cadrumo.adapters.persistence.profile.modelos_filing.ModeloRecordCatalogueRepository` while preserving translated recovery context for callers. """
[docs]defupsert_filing_record(catalogue:ModeloRecordCatalogue,record:ModeloRecord)->ModeloRecordCatalogue:"""Return a new :class:`ModeloRecordCatalogue` with ``record`` inserted or replaced. Args: catalogue: Source catalogue to update. record: The :class:`ModeloRecord` to insert or replace. """mapping=dict(catalogue.records)mapping[record.filing_record_id]=recordreturnModeloRecordCatalogue(records=mapping)