garázs fejlesztés

This commit is contained in:
Roo
2026-07-20 11:17:52 +00:00
parent 2e0abc62a7
commit 4594de6c11
80 changed files with 9135 additions and 8702 deletions

View File

@@ -40,7 +40,8 @@ from sqlalchemy.orm import joinedload
from app.models.marketplace.organization import Organization, OrgType, Branch, OrganizationMember, OrgUserRole
from app.models.identity.address import Address, GeoPostalCode
from app.models.marketplace.service import ServiceProfile, ServiceStatus, ExpertiseTag, ServiceExpertise, ServiceStaging
from app.models.marketplace.service import ServiceProfile, ServiceStatus, ExpertiseTag, ServiceExpertise
from app.models.marketplace.staged_data import ServiceStaging
from app.models.identity.social import ServiceProvider, ModerationStatus, SourceType
from app.models.gamification.gamification import PointRule, UserStats
from app.schemas.address import AddressOut
@@ -286,16 +287,17 @@ async def search_providers(
)
org_conditions.append(and_(*token_conditions))
if city:
# P0 UNIFIED ADDRESS REFACTOR (2026-07-01): A denormalizált címmezők
# helyett az Address → GeoPostalCode kapcsolaton keresztül érjük el
# a város és irányítószám adatokat.
# P0 UI/UX OVERHAUL (2026-07-09): Partial fuzzy search on city.
# A város keresés most már ILIKE %{city}% (bárhol a string-ben),
# nem csak StartsWith. Ez lehetővé teszi a részleges városnév
# keresést is (pl. "bud" → "Budapest").
city_clean = city.strip()
org_conditions.append(
or_(
GeoPostalCode.city == city_clean,
GeoPostalCode.city.ilike(f"{city_clean}%"),
GeoPostalCode.city.ilike(f"%{city_clean}%"),
GeoPostalCode.zip_code == city_clean,
GeoPostalCode.zip_code.ilike(f"{city_clean}%"),
GeoPostalCode.zip_code.ilike(f"%{city_clean}%"),
)
)
@@ -374,14 +376,14 @@ async def search_providers(
)
staging_conditions.append(and_(*token_conditions))
if city:
# SZIGORÍTÁS (2026-06-17): City keresés exact match vagy StartsWith
# P0 UI/UX OVERHAUL (2026-07-09): Partial fuzzy search on city
city_clean = city.strip()
staging_conditions.append(
or_(
ServiceStaging.city == city_clean,
ServiceStaging.city.ilike(f"{city_clean}%"),
ServiceStaging.city.ilike(f"%{city_clean}%"),
ServiceStaging.postal_code == city_clean,
ServiceStaging.postal_code.ilike(f"{city_clean}%"),
ServiceStaging.postal_code.ilike(f"%{city_clean}%"),
)
)
@@ -415,12 +417,12 @@ async def search_providers(
)
crowd_conditions.append(and_(*token_conditions))
if city:
# SZIGORÍTÁS (2026-06-17): City keresés exact match vagy StartsWith
# P0 UI/UX OVERHAUL (2026-07-09): Partial fuzzy search on city
city_clean = city.strip()
crowd_conditions.append(
or_(
ServiceProvider.address == city_clean,
ServiceProvider.address.ilike(f"{city_clean}%"),
ServiceProvider.address.ilike(f"%{city_clean}%"),
)
)
@@ -532,16 +534,26 @@ async def search_providers(
row_city = row.city
row_plus_code = getattr(row, "plus_code", None)
# P0 BUGFIX (2026-07-10): Null-safe AddressOut construction.
# A Pydantic v2 from_attributes=True mode-ban néha hibát dob,
# ha minden mező None. Itt try-excepttel védjük.
address_detail = None
if any([row_address_zip, row_address_street_name, row_address_street_type, row_address_house_number, row_city]):
address_detail = AddressOut(
zip=row_address_zip,
city=row_city,
street_name=row_address_street_name,
street_type=row_address_street_type,
house_number=row_address_house_number,
full_address_text=row.address,
)
try:
address_detail = AddressOut(
zip=row_address_zip,
city=row_city,
street_name=row_address_street_name,
street_type=row_address_street_type,
house_number=row_address_house_number,
full_address_text=row.address,
)
except Exception as addr_e:
logger.warning(
f"Failed to create AddressOut for provider {row.id} ({row.name}): {addr_e}. "
f"Skipping address_detail."
)
address_detail = None
results.append(
ProviderSearchResult(