Files
evig/scripts/db/migrations/059_it_hilfe_completion.sql
g-butandClaude Opus 4.6 f29dfcf411 feat: close the loop — IT-Hilfe completion, order flow, blog status
IT-Hilfe completion flow (migration 059):
- Helper marks request as completed (verifies accepted offer ownership)
- Requester confirms + submits 5-star rating with optional review text
- Creates review in reviews table (target_type='it_hilfe')
- Updates helper's average rating + total helps counter
- Email notifications: itHilfeCompleted, itHilfeReviewReceived
- New UI cards: MarkCompletedCard (helper), ConfirmReviewCard (requester)

Marketplace order completion (migration 060):
- Buyer confirm-receipt endpoint (captures escrow, transitions to completed)
- Order review endpoint (1-5 stars, optional content, recommend toggle)
- Updates seller's averageRating from all listing reviews
- OrderStatusTimeline component (5 steps: Bestellt→Bezahlt→Versandt→Erhalten→Bewertet)
- OrderReviewForm inline on buyer's order detail page
- Email templates: orderReceiptConfirmed, orderReviewPrompt, orderReviewReceived

Blog submitter status (migration 058):
- New /dashboard/blog-submissions page with status badges + stats
- Inline rejection reason display, revise-and-resubmit editor
- API: /api/blog/my-submissions and /api/blog/submissions/[id]/resubmit
- In-app notifications on admin status changes (previously email only)
- FIX: requestChanges() was setting status to 'pending' instead of
  'requires_changes' — now correctly uses APPROVAL_STATUS.REQUIRES_CHANGES

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 10:40:02 +02:00

14 lines
706 B
SQL

-- Migration 058: IT-Hilfe completion + review tracking
-- Adds columns to track the repair closure flow:
-- completed_at — when the helper marked the request done
-- completed_by — which user marked it done (helper)
-- reviewed_at — when the requester confirmed + reviewed
ALTER TABLE it_hilfe_requests
ADD COLUMN IF NOT EXISTS completed_at TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS completed_by UUID REFERENCES users(id) ON DELETE SET NULL,
ADD COLUMN IF NOT EXISTS reviewed_at TIMESTAMPTZ;
CREATE INDEX IF NOT EXISTS idx_it_hilfe_requests_completed_at ON it_hilfe_requests(completed_at);
CREATE INDEX IF NOT EXISTS idx_it_hilfe_requests_reviewed_at ON it_hilfe_requests(reviewed_at);