teszt állományok áthelyezése és szelektálása
This commit is contained in:
@@ -70,12 +70,14 @@ async def get_current_user(
|
||||
# We need to load the person relationship to avoid lazy loading issues
|
||||
# Also load Person.address for nested profile response
|
||||
from app.models.identity import Person
|
||||
from app.models.identity.address import Address
|
||||
from app.models.identity.address import Address, GeoPostalCode
|
||||
stmt = (
|
||||
select(User)
|
||||
.where(User.id == int(user_id))
|
||||
.options(
|
||||
joinedload(User.person).joinedload(Person.address)
|
||||
joinedload(User.person)
|
||||
.joinedload(Person.address)
|
||||
.joinedload(Address.postal_code) # <-- EZ KELL IDE: postal_code eager loading a zip/city property-khez
|
||||
)
|
||||
)
|
||||
result = await db.execute(stmt)
|
||||
|
||||
@@ -242,6 +242,9 @@ async def update_my_person(
|
||||
street_name=update_dict.get("address_street_name"),
|
||||
street_type=update_dict.get("address_street_type"),
|
||||
house_number=update_dict.get("address_house_number"),
|
||||
stairwell=update_dict.get("address_stairwell"),
|
||||
floor=update_dict.get("address_floor"),
|
||||
door=update_dict.get("address_door"),
|
||||
parcel_id=update_dict.get("address_hrsz"),
|
||||
)
|
||||
if addr_id:
|
||||
|
||||
@@ -57,12 +57,21 @@ class Address(Base):
|
||||
# Robot és térképes funkciók számára
|
||||
latitude: Mapped[Optional[float]] = mapped_column(Float)
|
||||
longitude: Mapped[Optional[float]] = mapped_column(Float)
|
||||
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
# Kapcsolat az irányítószám táblához (zip/city lekéréshez)
|
||||
postal_code: Mapped[Optional["GeoPostalCode"]] = relationship("GeoPostalCode", lazy="joined")
|
||||
|
||||
# ── Property-k a Pydantic AddressResponse zip/city mezőihez ──────────
|
||||
@property
|
||||
def zip(self) -> Optional[str]:
|
||||
"""Visszaadja az irányítószám stringet a kapcsolódó GeoPostalCode rekordból."""
|
||||
return self.postal_code.zip_code if self.postal_code else None
|
||||
|
||||
@property
|
||||
def city(self) -> Optional[str]:
|
||||
"""Visszaadja a város stringet a kapcsolódó GeoPostalCode rekordból."""
|
||||
return self.postal_code.city if self.postal_code else None
|
||||
|
||||
|
||||
class Rating(Base):
|
||||
|
||||
@@ -133,7 +133,7 @@ class GeoService:
|
||||
# Hozzáadjuk az atomizált kiegészítőket, ha vannak
|
||||
if stairwell: full_text += f" {stairwell}. lph."
|
||||
if floor: full_text += f" {floor}. em."
|
||||
if door: full_text += f" {door}. ajtó"
|
||||
if door: full_text += f" {door}. a."
|
||||
|
||||
# 6. Központi Address rekord rögzítése vagy lekérése (SELECT, majd INSERT)
|
||||
stmt_addr = select(Address).where(
|
||||
|
||||
Reference in New Issue
Block a user