No filters resolves the whole portfolio minus deletions 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-07 11:32:53 +00:00
parent 84fb9884d6
commit 3836729f92

View file

@ -10,7 +10,9 @@ from dataclasses import dataclass
from typing import Optional
from pydantic import BaseModel, ConfigDict
from sqlmodel import Session
from sqlmodel import Session, col, select
from infrastructure.postgres.property_table import PropertyRow
class PropertyGroupFilters(BaseModel):
@ -41,4 +43,16 @@ def resolve_filtered_property_ids(
portfolio's rows with ``marked_for_deletion = false``; property_type /
built_form resolve override lodged EPC predicted EPC legacy columns
"Unknown"."""
raise NotImplementedError
rows = session.exec(
select(PropertyRow)
.where(PropertyRow.portfolio_id == portfolio_id)
# IS NOT TRUE rather than == False: the FE schema defaults the flag,
# but a NULL must never silently exclude a property.
.where(col(PropertyRow.marked_for_deletion).isnot(True))
.order_by(col(PropertyRow.id))
).all()
return [
FilteredProperty(property_id=row.id, postcode=row.postcode)
for row in rows
if row.id is not None
]