Almost ready
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user