Skip to content

Integrate catalogue service API and fix favorites sync

Summary

  • Catalogue service integration: Replaced mock data with real API calls to darvest-catalogue-service. Added src/types/catalogue.ts with typed DTOs (PropertyDetailResponse, PropertyStatus, PropertyMediaType, etc.) matching the service contract. Updated propertyService.ts and all consumer pages/components (Properties, PropertyDetail, PortfolioPropertyDetail, InvestorDashboard, Portfolio, PropertyCard, InvestmentSimulator) to work with the new types.

  • Bug fix — favorites not syncing on PropertyDetail: PropertyDetail.tsx was managing favorites with its own local state, reading/writing directly to the generic darvest_favorites localStorage key. This bypassed FavoritesContext, which uses the per-user key darvest_favorites_<userId>. Clicking the heart on a property detail page had no effect on the rest of the app (portfolio, property cards, etc.). Fixed by replacing the local implementation with useFavorites() (isFavorite + toggleFavorite) from the context.

Test plan

  • Browse /properties — list loads from catalogue service without errors
  • Open a property detail page — all fields render correctly
  • Click the heart icon on a property detail page — favorite state updates immediately
  • Navigate to /properties or the portfolio — the same property shows as favorited
  • Unfavorite from the detail page — syncs back across all pages
  • Verify per-user isolation: favorite state resets when switching accounts

Rapports de requête de fusion