Files
evig/scripts/db/migrations/126_presentation_comments.sql
Mao NakamotoandClaude Opus 4.8 5fe8e02c64 feat(presentations): per-slide reader comments + admin collection
Readers of a shared deck can comment on any slide — signed in OR anonymous:
- New table presentation_comments (migration 126) + Drizzle schema.
- Public API /api/presentations/comments: GET (who-am-I for the form) +
  POST (anonymous allowed; signed-in identity taken from the session, not
  spoofable; honeypot for bots). Notifies super admins in-app per comment.
- Deck UI: a 'Kommentar' button on every slide (hidden in fullscreen/print/
  export) that posts feedback for the current slide.
- Admin /admin/presentations/feedback: comments grouped by deck -> slide with
  an 'Als Prompt kopieren' button (slide-keyed, paste-ready for the AI) and a
  resolve toggle. Feedback link + open-count badge on the Präsentationen page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 17:35:48 +02:00

25 lines
1.0 KiB
SQL

-- Presentation slide comments
-- Readers of a shared presentation deck (signed in OR anonymous) can leave
-- feedback on a specific slide. Staff collect it in /admin/presentations/feedback
-- and paste it to the AI to fix the slides. Anonymous comments are allowed
-- (author_user_id NULL, optional author_name); signed-in comments attach the
-- user server-side.
CREATE TABLE IF NOT EXISTS presentation_comments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
deck_slug TEXT NOT NULL,
slide_index INTEGER NOT NULL,
slide_title TEXT,
body TEXT NOT NULL,
author_name TEXT,
author_user_id UUID REFERENCES users(id) ON DELETE SET NULL,
is_staff BOOLEAN NOT NULL DEFAULT FALSE,
resolved BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS presentation_comments_deck_idx
ON presentation_comments (deck_slug, created_at DESC);
CREATE INDEX IF NOT EXISTS presentation_comments_unresolved_idx
ON presentation_comments (resolved, created_at DESC);