refaktorálás javításai
This commit is contained in:
@@ -28,8 +28,8 @@ class GeoService:
|
||||
|
||||
query = text("""
|
||||
SELECT DISTINCT s.name
|
||||
FROM data.geo_streets s
|
||||
JOIN data.geo_postal_codes p ON s.postal_code_id = p.id
|
||||
FROM system.geo_streets s
|
||||
JOIN system.geo_postal_codes p ON s.postal_code_id = p.id
|
||||
WHERE p.zip_code = :zip AND s.name ILIKE :q
|
||||
ORDER BY s.name ASC LIMIT :limit
|
||||
""")
|
||||
@@ -76,7 +76,7 @@ class GeoService:
|
||||
|
||||
# 2. Irányítószám és Város (Auto-learning / Upsert)
|
||||
zip_id_query = text("""
|
||||
INSERT INTO data.geo_postal_codes (zip_code, city, country_code)
|
||||
INSERT INTO system.geo_postal_codes (zip_code, city, country_code)
|
||||
VALUES (:z, :c, :cc)
|
||||
ON CONFLICT (country_code, zip_code, city) DO UPDATE SET city = EXCLUDED.city
|
||||
RETURNING id
|
||||
@@ -86,13 +86,13 @@ class GeoService:
|
||||
|
||||
# 3. Utca szótár frissítése
|
||||
await db.execute(text("""
|
||||
INSERT INTO data.geo_streets (postal_code_id, name) VALUES (:zid, :n)
|
||||
INSERT INTO system.geo_streets (postal_code_id, name) VALUES (:zid, :n)
|
||||
ON CONFLICT (postal_code_id, name) DO NOTHING
|
||||
"""), {"zid": zip_id, "n": street_name})
|
||||
|
||||
# 4. Közterület típus (út, utca, köz...)
|
||||
await db.execute(text("""
|
||||
INSERT INTO data.geo_street_types (name) VALUES (:n)
|
||||
INSERT INTO system.geo_street_types (name) VALUES (:n)
|
||||
ON CONFLICT (name) DO NOTHING
|
||||
"""), {"n": street_type.lower()})
|
||||
|
||||
@@ -113,7 +113,7 @@ class GeoService:
|
||||
|
||||
# 6. Központi Address rekord rögzítése vagy lekérése
|
||||
address_query = text("""
|
||||
INSERT INTO data.addresses (
|
||||
INSERT INTO system.addresses (
|
||||
postal_code_id, street_name, street_type, house_number,
|
||||
stairwell, floor, door, parcel_id, full_address_text
|
||||
)
|
||||
@@ -135,7 +135,7 @@ class GeoService:
|
||||
# 7. Biztonsági keresés: Ha létezett a rekord, de nem kaptunk ID-t a RETURNING-gal
|
||||
if not addr_id:
|
||||
lookup_query = text("""
|
||||
SELECT id FROM data.addresses
|
||||
SELECT id FROM system.addresses
|
||||
WHERE postal_code_id = :zid
|
||||
AND street_name = :sn
|
||||
AND street_type = :st
|
||||
|
||||
Reference in New Issue
Block a user