django-filter was already installed and set as DEFAULT_FILTER_BACKENDS but unused everywhere. Replace hand-rolled get_queryset filtering with FilterSet classes (stores/catalog/locations/reviews) and filterset_fields (orders status). drf-spectacular auto-documents these for swagger, so the manual OpenApiParameter declarations for the migrated fields are removed (stores keeps lat/lng manual since geo-distance isn't a plain filter). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1.8 KiB
1.8 KiB
Changelog
[Unreleased]
Fixed
GET /api/v1/stores/— documented thecategory,neighborhood,search,lat, andlngquery params for drf-spectacular so they render in swagger. The filtering itself already worked; only the OpenAPI schema was missing them (apps/stores/views.py).GET /api/v1/products/— same issue: documented the existingstore,category, andsearchquery params for swagger (apps/catalog/views.py).
Added
GET /api/v1/cities/?search=— search cities by name (apps/locations/views.py); previously no text search existed.GET /api/v1/neighborhoods/?search=— search neighborhoods by neighborhood name or city name, alongside the existingcityUUID filter (apps/locations/views.py).GET /api/v1/stores/now returnsphone_numberin the list (previously only on the single-store detail view) and adistance_kmfield, populated wheneverlat/lngare passed (apps/stores/serializers.py).- Test coverage for
StoreViewSetlist filtering (apps/stores/tests/test_store_list.py) — previously untested. - Test coverage for
ProductViewSetlist filtering (apps/catalog/tests/test_product_list.py) — previously untested. - Test coverage for
CityViewSet/NeighborhoodViewSetlist filtering (apps/locations/tests/test_location_list.py) — previously untested.
Changed
- Replaced hand-rolled
get_querysetfiltering withdjango-filterFilterSetclasses (apps/{stores,catalog,locations,reviews}/filters.py) andfilterset_fields(apps/ordersstatus).django-filterwas already installed and set asDEFAULT_FILTER_BACKENDSbut unused everywhere; params are now auto-documented in swagger by drf-spectacular's django-filter integration, so the manualOpenApiParameterdeclarations for those fields were removed (stores keepslat/lngmanual since geo-distance isn't a plain filter).