refactor(feedback): align package + DB enums, plan central hub

Macht @mana/feedback zur SSOT für alle Nutzer-Feedback-Categories und
-Status — Voraussetzung dafür, dass Onboarding-Wishes, NPS, Churn-Feedback
etc. künftig dort landen.

- Status-Enum: DB-Werte umbenannt new/reviewed/done/rejected →
  submitted/under_review/completed/declined (Package gewinnt). PG≥10
  ALTER TYPE … RENAME VALUE ist non-destructive.
- Category 'praise' ins Package aufgenommen (war nur in DB).
- Category 'onboarding-wish' neu in Package + DB für den Wish-Step.
- Default status in DB: 'new' → 'submitted'.
- CreateFeedbackInput.isPublic optional → Service reicht durch, default
  bleibt true; private Categories wie onboarding-wish setzen false.
- Schema-Datei mit SSOT-Kommentar versehen, der Drift in Zukunft verhindert.

Hand-authored Migration unter services/mana-analytics/drizzle/0001_*.sql
weil drizzle-kit push Enum-Werte nicht zuverlässig umbenennt. Manuell
einspielen vor nächstem db:push:

  psql "\$DATABASE_URL" -f services/mana-analytics/drizzle/0001_align-feedback-enums.sql

Plan in docs/plans/feedback-hub.md (Phase 0–4); Phase 0 + 1 jetzt, 2-4
deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-26 21:52:25 +02:00
parent bf3bca268a
commit ba6274edbe
6 changed files with 339 additions and 7 deletions

View file

@ -8,6 +8,12 @@ export interface CreateFeedbackInput {
title?: string;
feedbackText: string;
category?: FeedbackCategory;
/**
* Whether the submission shows up in the public community list.
* Defaults to `true` server-side. Set `false` for private intake
* categories like `onboarding-wish` or `churn-feedback`.
*/
isPublic?: boolean;
deviceInfo?: Record<string, unknown>;
}

View file

@ -1,8 +1,20 @@
/**
* Core feedback types
* Core feedback types Single source of truth for the @mana/feedback hub.
*
* Mana-analytics' Postgres enums (`feedback.feedback_category`,
* `feedback.feedback_status`) MUST mirror these literal unions exactly.
* If you add or rename a value here, also write a SQL migration under
* services/mana-analytics/drizzle/.
*/
export type FeedbackCategory = 'bug' | 'feature' | 'improvement' | 'question' | 'other';
export type FeedbackCategory =
| 'bug'
| 'feature'
| 'improvement'
| 'question'
| 'praise'
| 'onboarding-wish'
| 'other';
export type FeedbackStatus =
| 'submitted'
@ -43,6 +55,8 @@ export const FEEDBACK_CATEGORY_LABELS: Record<FeedbackCategory, string> = {
feature: 'Feature',
improvement: 'Verbesserung',
question: 'Frage',
praise: 'Lob',
'onboarding-wish': 'Was ich mir wünsche',
other: 'Sonstiges',
};