aeat.adapters.persistence.profile.fincas module¶
ORM-backed repositories for the rental-register record types.
These concrete repositories are the persistence adapter behind the
read-side ports declared in domain.fincas._repository_ports.
They bridge the public domain.fincas._models records and the
internal adapters.persistence.storage.sql._orm mapper rows;
every method routes through _flush_or_wrap so DB integrity violations
surface as RepositoryError.
Living in the persistence adapter (not in domain.fincas) keeps
the SQLAlchemy and ORM-row coupling out of the domain layer: the domain
aggregation functions depend only on the structural * reader ports,
never on this module. Storage imports remain deferred behind the methods
that consult them so the module stays import-light.
- class FincaRepository(session)[source]¶
Bases:
objectRepository for
Finca.- Parameters:
session (Session)
- get(record_id)[source]¶
Return the record with surrogate id
record_id.- Parameters:
record_id (
int) – Surrogate integer primary key.- Return type:
- Returns:
The matching
Fincarecord.- Raises:
RepositoryError – When no row matches.
- class ArrendamientoRepository(session)[source]¶
Bases:
objectRepository for
Arrendamiento.- Parameters:
session (Session)
- list_all()[source]¶
Return every
Arrendamientorecord in the table, ordered by surrogate id.- Return type:
- list_for_finca(finca_id)[source]¶
Return every
Arrendamientorecord attached to the supplied finca.- Return type:
- Parameters:
finca_id (int)
- get(record_id)[source]¶
Return the record with surrogate id
record_id.- Parameters:
record_id (
int) – Surrogate integer primary key.- Return type:
- Returns:
The matching
Arrendamientorecord.- Raises:
RepositoryError – When no row matches.
- upsert(record)[source]¶
Insert or update
recordand return the persistedArrendamiento.- Return type:
- Parameters:
record (Arrendamiento)
- class FincaRendimientoRepository(session)[source]¶
Bases:
objectRepository for
FincaRendimientoRecord.- Parameters:
session (Session)
- list_for_period(period_year)[source]¶
Return every record whose period overlaps the supplied window.
- Return type:
- Returns:
List of
FincaRendimientoRecordfor the given period year.- Parameters:
period_year (int)
- get_for_contract_period(contract_id, period_year)[source]¶
Return the
FincaRendimientoRecordforcontract_idmatchingperiod, orNone.- Return type:
- Parameters:
- upsert(record)[source]¶
Insert or update
recordand return the persistedFincaRendimientoRecord.- Return type:
- Parameters:
record (FincaRendimientoRecord)
- class FincaGastoRepository(session)[source]¶
Bases:
objectRepository for
FincaGasto.- Parameters:
session (Session)
- list_for_finca_period(finca_id, period_year)[source]¶
Return every
FincaGastorecord attached tofinca_idwithin the period window.- Return type:
- Parameters:
- add(record)[source]¶
Insert
recordand return the persistedFincaGastoentity.- Return type:
- Parameters:
record (FincaGasto)
- upsert(record)[source]¶
Insert or update
recordand return the persisted entity.- Return type:
- Returns:
The persisted
FincaGastowith any database-generated fields populated.- Parameters:
record (FincaGasto)
- class FincaAmortizacionLedgerRepository(session)[source]¶
Bases:
objectRepository for
FincaAmortizacionLedgerEntry.- Parameters:
session (Session)
- list_for_finca(finca_id)[source]¶
Return every record attached to the supplied finca.
- Return type:
- Returns:
List of
FincaAmortizacionLedgerEntryfor the finca.- Parameters:
finca_id (int)
- get_for_finca_period(finca_id, period_year)[source]¶
Return the record for
finca_idmatchingperiod, orNone.- Return type:
- Returns:
The matching
FincaAmortizacionLedgerEntry, orNonewhen absent.- Parameters:
- upsert(record)[source]¶
Insert or update
recordand return the persistedFincaAmortizacionLedgerEntry.- Return type:
- Parameters:
record (FincaAmortizacionLedgerEntry)