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

@@ -482,7 +482,7 @@ export const api = {
list: (slug: string) =>
req<ReviewApi[]>('GET', `/api/hotels/${slug}/reviews`),
update: (slug: string, id: string, data: { reply?: string; isPublic?: boolean }) =>
update: (slug: string, id: string, data: { reply?: string; isPublic?: boolean; rejected?: boolean }) =>
req<ReviewApi>('PATCH', `/api/hotels/${slug}/reviews/${id}`, data),
},
@@ -1874,6 +1874,7 @@ export interface ReviewApi {
reply: string | null
repliedAt: string | null
isPublic: boolean
rejectedAt: string | null
roomNumber: string | null
bookingSource: string | null
createdAt: string