48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
import uuid
|
|
from sqlalchemy import Column, String, Integer, ForeignKey, Text, DateTime, Float
|
|
from sqlalchemy.dialects.postgresql import UUID as PG_UUID
|
|
from sqlalchemy.sql import func
|
|
from app.db.base_class import Base
|
|
|
|
class GeoPostalCode(Base):
|
|
__tablename__ = "geo_postal_codes"
|
|
__table_args__ = {"schema": "data"}
|
|
id = Column(Integer, primary_key=True)
|
|
country_code = Column(String(5), default="HU")
|
|
zip_code = Column(String(10), nullable=False)
|
|
city = Column(String(100), nullable=False)
|
|
|
|
class GeoStreet(Base):
|
|
__tablename__ = "geo_streets"
|
|
__table_args__ = {"schema": "data"}
|
|
id = Column(Integer, primary_key=True)
|
|
postal_code_id = Column(Integer, ForeignKey("data.geo_postal_codes.id"))
|
|
name = Column(String(200), nullable=False)
|
|
|
|
class GeoStreetType(Base):
|
|
__tablename__ = "geo_street_types"
|
|
__table_args__ = {"schema": "data"}
|
|
id = Column(Integer, primary_key=True)
|
|
name = Column(String(50), unique=True, nullable=False)
|
|
|
|
class Address(Base):
|
|
"""Univerzális cím entitás GPS adatokkal kiegészítve."""
|
|
__tablename__ = "addresses"
|
|
__table_args__ = {"schema": "data"}
|
|
|
|
id = Column(PG_UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
postal_code_id = Column(Integer, ForeignKey("data.geo_postal_codes.id"))
|
|
street_name = Column(String(200), nullable=False)
|
|
street_type = Column(String(50), nullable=False)
|
|
house_number = Column(String(50), nullable=False)
|
|
stairwell = Column(String(20))
|
|
floor = Column(String(20))
|
|
door = Column(String(20))
|
|
parcel_id = Column(String(50))
|
|
full_address_text = Column(Text)
|
|
|
|
# Robot és térképes funkciók számára
|
|
latitude = Column(Float)
|
|
longitude = Column(Float)
|
|
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now()) |