mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
`property` is an FE-owned table the backend only ever reads — every row read carries an id — so the autoincrement-PK `Optional[int]` idiom doesn't apply here. Make it `int` and drop the now-redundant None guard in get_many. (Contrast: solar_table keeps Optional id — the backend DOES insert those, so id is genuinely None pre-flush.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
927 B
Python
25 lines
927 B
Python
from __future__ import annotations
|
|
|
|
from typing import ClassVar, Optional
|
|
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class PropertyRow(SQLModel, table=True):
|
|
"""Defensive view of the FE-owned ``property`` table.
|
|
|
|
The schema and migrations for ``property`` are owned by the front-end
|
|
Next.js repo; this declares only the identity columns the modelling backend
|
|
reads/writes, so FE-owned migrations to other columns don't ripple into us.
|
|
"""
|
|
|
|
__tablename__: ClassVar[str] = "property" # pyright: ignore[reportIncompatibleVariableOverride]
|
|
|
|
# Non-Optional: this is a read-only defensive view of the FE-owned ``property``
|
|
# table — the backend never inserts rows, so every row read carries an id.
|
|
id: int = Field(primary_key=True)
|
|
portfolio_id: int
|
|
postcode: str
|
|
address: str
|
|
uprn: Optional[int] = Field(default=None)
|
|
landlord_property_id: Optional[str] = Field(default=None)
|