aeat.domain.modelos._repository 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. The storage contract is declared by aeat.adapters.persistence.storage.MODELO_WORK_UNIT_CATALOGUE_NAMESPACE; its default object key is the singleton catalogue row.

exception WorkUnitPersistenceError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: ModeloError

Raised when the work-unit catalogue cannot be loaded or saved.

This wraps storage-boundary failures from WorkUnitCatalogueRepository while preserving translated recovery context for callers.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
upsert_work_unit(catalogue, unit)[source]

Return a new WorkUnitCatalogue with unit inserted or replaced.

The input catalogue is not mutated. The returned catalogue carries the same work units as the input plus unit at its deterministic work_unit_id; any existing entry under that id is replaced.

Return type:

WorkUnitCatalogue

Parameters:
remove_work_unit(catalogue, work_unit_id)[source]

Return a new catalogue with work_unit_id removed.

Removing an absent id is a no-op that returns a value-equal catalogue. The original is not mutated.

Return type:

WorkUnitCatalogue

Returns:

A WorkUnitCatalogue without the given work unit.

Parameters: