Remove prediction API endpoint and integrate into stations search
Consolidate prediction functionality by merging /api/prediction endpoint into /api/stations response. Move prediction logic from PredictionController into StationController, returning prediction data alongside station results. Replace usePrediction composable with unified useStations that returns {stations, meta, prediction}. Remove PredictionRequest, related tests, and unused Vue components (FuelFinderTest, MapTest, RecommendationTest, StationListTest). Add PredictionFull component and UpsellBanner. Extend NationalFuelPredictionService to include weekly_summary (7-day series, yesterday/today averages, cheapest/priciest days) and oil signal from price_predictions table. Update Home.vue to consume prediction from stations response. Add Plan::resolveCadenceForUser helper and configure Cashier to use custom Subscription model.
This commit is contained in:
@@ -4,6 +4,7 @@ import api from '../axios.js'
|
||||
export function useStations() {
|
||||
const stations = ref([])
|
||||
const meta = ref(null)
|
||||
const prediction = ref(null)
|
||||
const loading = ref(false)
|
||||
const error = ref(null)
|
||||
|
||||
@@ -12,6 +13,7 @@ export function useStations() {
|
||||
error.value = null
|
||||
stations.value = []
|
||||
meta.value = null
|
||||
prediction.value = null
|
||||
|
||||
const params = { fuel_type: fuelType, radius, sort }
|
||||
|
||||
@@ -26,6 +28,7 @@ export function useStations() {
|
||||
const response = await api.get('/stations', { params })
|
||||
stations.value = response.data.data
|
||||
meta.value = response.data.meta
|
||||
prediction.value = response.data.prediction ?? null
|
||||
} catch (err) {
|
||||
error.value = err.response?.data?.errors
|
||||
?? { general: ['Unable to load stations. Please try again.'] }
|
||||
@@ -37,9 +40,10 @@ export function useStations() {
|
||||
function reset() {
|
||||
stations.value = []
|
||||
meta.value = null
|
||||
prediction.value = null
|
||||
error.value = null
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
return { stations, meta, loading, error, search, reset }
|
||||
return { stations, meta, prediction, loading, error, search, reset }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user