aeat.domain.fincas._repository_ports module

Read-side repository ports for rental-register aggregation.

These Protocol declarations are the hexagonal boundary between the pure domain.fincas aggregation logic and the ORM-backed concrete repositories that live in the persistence adapter (adapters.persistence.profile.fincas). The aggregation functions in _aggregates annotate against these ports and depend only on the read methods they call, never on SQLAlchemy or the storage mapper rows — keeping the domain layer free of adapter coupling.

The concrete adapter repositories satisfy these ports structurally; no explicit subclassing is required. Each port declares exactly the read method the aggregation pipeline consumes (interface segregation), so a port change is a real change to what the domain needs.

The port set is FincaReader, ArrendamientoReader, FincaRendimientoReader, FincaGastoReader, and FincaAmortizacionLedgerReader; each returns the corresponding Finca, Arrendamiento, FincaRendimientoRecord, FincaGasto, or FincaAmortizacionLedgerEntry record. The adapter implementations are FincaRepository, ArrendamientoRepository, FincaRendimientoRepository, FincaGastoRepository, and FincaAmortizacionLedgerRepository.

class FincaReader(*args, **kwargs)[source]

Bases: Protocol

Read port over the Finca register.

list_all()[source]

Return every persisted Finca record.

Return type:

list[Finca]

class ArrendamientoReader(*args, **kwargs)[source]

Bases: Protocol

Read port over the Arrendamiento (rental contract) register.

list_for_finca(finca_id)[source]

Return every Arrendamiento attached to finca_id.

Return type:

list[Arrendamiento]

Parameters:

finca_id (int)

class FincaRendimientoReader(*args, **kwargs)[source]

Bases: Protocol

Read port over the FincaRendimientoRecord income register.

get_for_contract_period(contract_id, period_year)[source]

Return the FincaRendimientoRecord for contract_id in period_year, or None.

Return type:

FincaRendimientoRecord | None

Parameters:
  • contract_id (int)

  • period_year (int)

class FincaGastoReader(*args, **kwargs)[source]

Bases: Protocol

Read port over the FincaGasto expense register.

list_for_finca_period(finca_id, period_year)[source]

Return every FincaGasto for finca_id within period_year.

Return type:

list[FincaGasto]

Parameters:
  • finca_id (int)

  • period_year (int)

class FincaAmortizacionLedgerReader(*args, **kwargs)[source]

Bases: Protocol

Read port over the FincaAmortizacionLedgerEntry ledger.

list_for_finca(finca_id)[source]

Return every FincaAmortizacionLedgerEntry attached to finca_id.

Return type:

list[FincaAmortizacionLedgerEntry]

Parameters:

finca_id (int)