feat: reviews module — email request after checkout, API, job

- Migration 084: add review_token, review_email_sent_at, review_retry_sent_at to bookings
- Backend route /api/hotels/:slug/reviews (GET list, PATCH reply/status)
- Backend public routes /api/public/review/:token (GET config, POST submit)
- email.ts: sendReviewRequestEmail template
- jobs.ts: runReviewRequestJob — sends email N hours after checkout, retry after 24h
- app.ts: register reviewsRoutes
- api.ts: add ReviewApi, PublicReviewConfig types + reviews/publicReview methods
- ReviewsPage: connect to real API, load/save settings, remove SMS option
- GuestReviewPage: use :token param, fetch config from API, submit to API
- App.tsx: route /review/:slug → /review/:token

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 00:04:59 +03:00
parent 696cf4d38c
commit 1ab2751854
9 changed files with 687 additions and 353 deletions

View File

@@ -0,0 +1,8 @@
-- Migration 084 — review tokens on bookings
ALTER TABLE bookings
ADD COLUMN IF NOT EXISTS review_token TEXT UNIQUE,
ADD COLUMN IF NOT EXISTS review_email_sent_at TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS review_retry_sent_at TIMESTAMPTZ;
CREATE INDEX IF NOT EXISTS idx_bookings_review_token ON bookings(review_token);