- Split mother's name in KYC (last/first) - Added mileage_unit and fuel_type to Assets - Expanded AssetCost for international VAT and original currency - Fixed SQLAlchemy IndexError in asset catalog lookup - Added exchange_rate and ratings tables to models
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
import uuid
|
|
from sqlalchemy import Column, String, Integer, ForeignKey, Text, DateTime
|
|
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):
|
|
__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)) # HRSZ
|
|
full_address_text = Column(Text)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now()) |