Almost ready

This commit is contained in:
Eric Gullickson
2025-11-08 15:34:29 -06:00
parent bb4a356b9e
commit 408a0736c0
7 changed files with 66 additions and 60 deletions

View File

@@ -125,18 +125,32 @@ export class StationsService {
async getUserSavedStations(userId: string) {
const savedStations = await this.repository.getUserSavedStations(userId);
// Enrich with cached station data
const enriched = await Promise.all(
savedStations.map(async (saved: SavedStation) => {
const station = await this.repository.getCachedStation(saved.stationId);
// Flatten station data into top level to match frontend SavedStation type
// Frontend expects SavedStation to extend Station
return {
...saved,
// Merge cached station data at top level (with fallbacks if cache miss)
name: station?.name || saved.nickname || 'Saved Station',
address: station?.address || '',
latitude: station?.latitude || 0,
longitude: station?.longitude || 0,
rating: station?.rating,
photoUrl: station?.photoUrl,
priceRegular: station?.priceRegular,
pricePremium: station?.pricePremium,
priceDiesel: station?.priceDiesel,
// Keep nested station for compatibility
station
};
})
);
return enriched;
}