fix: reviews — correct pending/archive logic, rejected_at field, stats, reply email

- Migration 085: add rejected_at to reviews
- pending = !isPublic && !reply && !rejectedAt
- archived = isPublic || reply || rejectedAt
- Stats: avgRating/NPS from all reviews; 'В архиве' = archived count
- sendReply: no longer sets isPublic=true on negative reviews
- reject: sets rejected_at=NOW() (distinct from pending)
- restore: clears rejected_at (now actually works)
- Badge 'Отклонён' for rejected reviews, opacity-60

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 10:33:01 +03:00
parent 89e919bd8d
commit 47215c7d64
4 changed files with 37 additions and 26 deletions

View File

@@ -0,0 +1,2 @@
-- Migration 085 — add rejected_at to reviews for explicit rejected state
ALTER TABLE reviews ADD COLUMN IF NOT EXISTS rejected_at TIMESTAMPTZ;