aeat.adapters.persistence.profile.modelos_work_units module¶
Encrypted SQL repository for the modelo work-unit catalogue.
WorkUnitCatalogueRepository persists WorkUnit records in a
WorkUnitCatalogue at FINANCIAL
SensitivityClass through
SecureObjectRepository. The
catalogue is serialised as a single
Envelope-wrapped JSON payload keyed
by a stable namespace and object key; the underlying column is encrypted so no
plaintext work-unit metadata lands on disk.
This concrete repository is the persistence adapter behind the read-side
WorkUnitCatalogueRepositoryProtocol. It lives in
the persistence adapter (not in modelos) because its
secure-object coupling is SQL/crypto-bound; the domain package owns only the
typed WorkUnitCatalogue model and its pure catalogue mutators.
See also
_modelo_runtimeBucket-id resolution and runtime secure-object factory shared by modelo persistence adapters.
WorkUnitCatalogueDomain catalogue payload encrypted by this repository.
WorkUnitCatalogueRepositoryProtocolDomain port this concrete persistence adapter implements.
MODELO_WORK_UNIT_CATALOGUE_NAMESPACECentral namespace, sensitivity, schema-version, and singleton-key contract for these secure objects.
modelos_calculationSibling calculation-revision repository referenced by work-unit current and verification lifecycle state.
modeloApplication facade that creates, calculates, verifies, files, and exports work units from this catalogue.
- class WorkUnitCatalogueRepository(*, bucket_id=None, objects=None)[source]¶
Bases:
objectRepository over encrypted SQL-backed work-unit catalogue storage.
A single envelope-wrapped catalogue object holds every work unit. Loads return an empty catalogue when no object has been persisted yet (no separate “fresh install” path is needed). The
WorkUnitCataloguepayload is wrapped inEnvelopebefore theSecureObjectRepositorypersists it; this class is the concrete implementation behindWorkUnitCatalogueRepositoryProtocol.- Parameters:
bucket_id (str | None)
objects (SecureObjectRepository | None)
- load()[source]¶
Return the persisted catalogue or an empty catalogue if absent.
- Return type:
- Returns:
The deserialised
WorkUnitCatalogue, or an empty instance when no object has been persisted yet.- Raises:
WorkUnitPersistenceError – When the persisted envelope’s classification or schema version disagrees with the consumer’s contract.
- save(catalogue)[source]¶
Persist
catalogueas the encrypted singleton object.The on-disk database value is an encrypted
EnvelopeBLOB at theSensitivityClassFINANCIALclassification.- Parameters:
catalogue (
WorkUnitCatalogue) – TheWorkUnitCatalogueto persist.- Return type: