aeat.adapters.persistence.profile.filing_amendments module

Governed-persistence repository for filing amendments.

Filing amendments carry corrected casilla deltas and original submission references. They are stored as encrypted byte objects via SecureObjectRepository at AUDIT SensitivityClass sensitivity; no plaintext amendment JSON or envelope file lands on disk. Each record is wrapped in an Envelope before serialisation.

This concrete repository is the persistence adapter behind the ModeloAmendmentRepositoryProtocol port. It lives in the persistence adapter (not in domain.filing) because its secure-object coupling is SQL/crypto-bound; the domain package owns only the typed BaseAmendment payload shapes.

See also

BaseAmendment

Shared typed payload shape saved by this repository.

ModeloComplementaria

LGT Art. 122.2 amendment variant for additional self-assessment.

ModeloSustitutiva

LGT Art. 122.1 amendment variant for full replacement.

adapters.persistence.storage.FILING_AMENDMENTS_NAMESPACE

Namespace, sensitivity, schema-version, object-key, and custody contract for amendment secure objects.

application.filing.build_complementaria()

Application orchestration entry point that can produce and persist an amendment.

class ModeloAmendmentRepository(*, bucket_id=None, objects=None)[source]

Bases: object

Encrypted AUDIT repository for BaseAmendment records.

Persists ModeloComplementaria and ModeloSustitutiva payloads under adapters.persistence.storage.FILING_AMENDMENTS_NAMESPACE. The repository wraps the amendment union in an Envelope before writing through SecureObjectRepository; the amendment id is the natural key used for load, delete, and ordered iteration. The namespace definition supplies the AUDIT SensitivityClass, schema version, object-key grammar, and custody contract.

Parameters:
property bucket_id: str | None

Return the profile bucket id when this repository resolved one.

property store_dir: Path

Return a logical backend marker for diagnostic messages.

envelope_path_for(amendment_id)[source]

Return a logical object marker for amendment_id.

Return type:

Path

Parameters:

amendment_id (str)

lock_target_for(amendment_id)[source]

Return a logical lock marker; SQL transactions govern writes.

Return type:

Path

Parameters:

amendment_id (str)

load(amendment_id)[source]

Return the persisted amendment or None if absent.

Return type:

TypeAliasType | None

Parameters:

amendment_id (str)

save(amendment)[source]

Persist amendment in the encrypted database object store.

The row is stored under adapters.persistence.storage.FILING_AMENDMENTS_NAMESPACE.

Return type:

None

Parameters:

amendment (BaseAmendment)

delete(amendment_id)[source]

Remove the persisted amendment for amendment_id.

Return type:

bool

Parameters:

amendment_id (str)

list_amendment_ids()[source]

Return every amendment id persisted in this repository.

Return type:

tuple[str, ...]

iter_amendments()[source]

Yield every persisted amendment, in lexicographic id order.

Return type:

Iterator[TypeAliasType]