feat: add updated and brand sort options to /api/stations endpoint
Extends NearbyStationsRequest validation to accept `sort=updated` and `sort=brand`. Updates StationController to use match expression with dedicated closures: 'updated' sorts by price_effective_at descending (newest first), 'brand' sorts alphabetically by brand_name, with existing price and distance options.
This commit is contained in:
@@ -20,7 +20,7 @@ class NearbyStationsRequest extends FormRequest
|
||||
'lng' => ['required_without:postcode', 'nullable', 'numeric', 'between:-180,180'],
|
||||
'fuel_type' => ['required', 'string'],
|
||||
'radius' => ['nullable', 'numeric', 'between:0.1,50'],
|
||||
'sort' => ['nullable', 'string', 'in:price,distance'],
|
||||
'sort' => ['nullable', 'string', 'in:price,distance,updated,brand'],
|
||||
'pricing_mode' => ['nullable', 'string', 'in:pump'],
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user