aeat.adapters.persistence.profile.submission module

Governed-persistence repository for submission audit records.

Submission audit records keep the local or imported domain.submission.ModeloPresentado lifecycle: draft id, modelo, period, taxpayer identity, AEAT receipt metadata when observed, and attempt summaries. They are stored as encrypted byte objects in the primary SQL backend at AUDIT SensitivityClass; no plaintext submission JSON or envelope file lands on disk.

This concrete repository is the persistence adapter behind the read-side domain.submission.SubmissionRepositoryProtocol. It lives in the persistence adapter (not in domain.submission) because its base SecureBoundRepository is SQL/crypto-coupled; the domain package depends only on the structural port.

See also

domain.submission.ModeloPresentado

Payload model encrypted by this repository.

domain.submission.SubmissionRepositoryProtocol

Domain-facing read port this repository satisfies structurally.

adapters.persistence.storage.SecureObjectRepository

SQL object store underlying the bound repository.

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

Bases: SecureBoundRepository[ModeloPresentado]

Encrypted AUDIT repository for ModeloPresentado records.

The SecureBoundRepository base stores each ModeloPresentado in a Envelope row under the AUDIT submission-records namespace. The natural key is the submission id, so the list and iteration APIs expose historical filing attempts rather than any live submission capability.

See also

domain.submission.SubmissionRepositoryProtocol

Domain read port this class satisfies.

SecureObjectRepository

SQL object store composed by the bound repository base.

Parameters:
namespace: ClassVar[str]
sensitivity: ClassVar[SensitivityClass]
schema_version: ClassVar[int]
classmethod payload_model()[source]

Return the concrete Pydantic payload model for this repository.

Return type:

type[ModeloPresentado]

extract_identifier(payload)[source]

Return the natural id for payload (used as the SQL object key).

Subclasses MUST override. The base implementation raises NotImplementedError.

Return type:

str

Parameters:

payload (ModeloPresentado)

list_submission_ids()[source]

Return every submission id persisted in this repository, in lexicographic order.

Return type:

tuple[str, ...]

iter_submissions()[source]

Yield every persisted submission, in lexicographic id order.

Audit-record enumeration is resilient: rows that fail classification or schema-version gates are logged and skipped rather than aborting the iteration. Diagnostic surfaces depend on listing all healthy submissions even when a single row is unreadable.

Return type:

Iterator[ModeloPresentado]

Returns:

Iterator over ModeloPresentado records.