endpoint setup

This commit is contained in:
exolonConfidental
2026-02-08 11:18:47 +05:30
parent 8fb3b7cf67
commit a77788fc47
33 changed files with 932 additions and 352 deletions

View File

@@ -1,4 +1,5 @@
from sqlalchemy import String, Integer, Float, BigInteger
from geoalchemy2 import Geography
from sqlalchemy import String, Integer, Float, BigInteger, UniqueConstraint
from sqlalchemy.orm import relationship
from sqlalchemy.orm import Mapped, mapped_column
from app.db.models.base import Base
@@ -7,6 +8,9 @@ from app.db.models.base import Base
class Location(Base):
__tablename__ = "locations"
__table_args__ = (
UniqueConstraint("osm_type", "osm_id", name="uq_osm_location"),
)
id: Mapped[int] = mapped_column(primary_key=True, index=True)
@@ -38,6 +42,10 @@ class Location(Base):
bbox_lon_min: Mapped[float] = mapped_column(Float)
bbox_lon_max: Mapped[float] = mapped_column(Float)
geom: Mapped[str] = mapped_column(
Geography("POINT", srid=4326)
)
property = relationship(
"Property",
back_populates="location",