Seller sets this at registration (default 60 min). Exposed on store list/detail, the seller's own store, cart groups (GET /api/v1/cart/), and order/order-group responses, so the checkout page's estimated delivery time no longer needs a frontend mock. Also document CartSerializer's groups/grand_total for swagger (were untyped SerializerMethodFields showing as opaque strings) since that's the endpoint carrying this new field to the checkout page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3.4 KiB
3.4 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).- Cart items:
CartItemViewwas registered on both/api/v1/cart/items/and/api/v1/cart/items/{item_uuid}/, so swagger showed POST/PATCH/DELETE on both paths — 3 of those 6 combinations crashed with aTypeErrorat runtime (item_uuidmissing or unexpected). Split intoCartItemView(POST only, list path) andCartItemDetailView(PATCH/DELETE only, detail path) so swagger only shows the combinations that actually work (apps/orders/views.py,apps/orders/urls.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).- Store
latitude/longitudenow come back on every store response — list, retrieve, and the seller's own store (GET/PATCH/POST /api/v1/seller/store/) — derived fromStore.locationvia newStore.latitude/Store.longitudeproperties (apps/stores/models.py,apps/stores/serializers.py). Previously they were write-only on the seller serializer and absent everywhere else. - 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. - New
Store.max_delivery_time_minutesfield, set by the seller at registration (default 60), returned wherever a store appears in a response — store list/detail, the seller's own store, cart groups (GET /api/v1/cart/), and order/order-group serializers — so the checkout page's estimated-delivery-time UI no longer needs a frontend mock (apps/stores/models.py,apps/stores/serializers.py, migration0003_store_max_delivery_time_minutes). - Documented
CartSerializer'sgroups/grand_totalfields for swagger (apps/orders/serializers.py) — they wereSerializerMethodFields with no schema, showing as opaque strings instead of the actual nested structure.
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).