ReviewOS

stacks/wildloop

Trail reviews: add a submission form + endpoint (currently display-only)

#981
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Problem

The Review model + trail_reviews table exist, but the trail detail Reviews/Conditions tabs are display-only from seedReviews — there's no submission form and no trailbuddy review endpoint wired.

Acceptance

  • Review create/list endpoints for a trail; recompute trail rating/review_count.
  • Review form on the trail detail page; render real reviews.
9 days ago

Done in 07491725.

  • List endpoint: GET /trails/{id}/reviews (public) — newest first, author names batch-joined. The store/upsert endpoint already existed from #973 (POST /trails/{id}/reviews, one review per user per trail, recomputes trail rating/review_count after every write).
  • Review form on the trail detail page: star picker, conditions select, content textarea. Resubmitting updates your existing review (upsert) instead of duplicating. On success the recomputed rating/review_count mirror into the store so the hero header and trail cards update live.
  • Real reviews render: the Reviews tab hydrates from the API (seed fallback), shows per-review conditions, and has a proper empty state.

Verified by scripts/verify-trail-reviews.ts (9 checks: joined list, 422 on junk id, form flow create→list→aggregates, upsert keeps count, trail row matches response). All 13 suites green.

Sign in to comment on this issue.