dialog: eigene Diskussion pro Beitrag (MVP, flach, eingeladene-only)
- DB: public.comments (thread, parent_id, user_id, author_name/-avatar, body, deleted) - API: GET /api/comments (öffentlich lesen), POST/DELETE (eingeloggt), POST /api/auth/login (Token fürs Widget) - Vanilla-Widget static/dialog.js: Karten mit Name+Bild, flacher Dialog mit optionalem Bezug (↳ Antwort auf), Inline-Login, Löschen (eigene/Admin) - eingebettet in single.html (thread = Beitrags-Pfad), Styling im Theme-Look - Autorname/-bild kommen aus dem Profil (data/authors.json) Realtime (Supabase) folgt als nächster Schritt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -31,3 +31,21 @@ create index if not exists posts_section_idx on public.posts (section);
|
||||
-- RLS aktivieren; die api nutzt den Service-Key (umgeht RLS). Wenn das
|
||||
-- Frontend später direkt liest, hier gezielte Policies ergänzen.
|
||||
alter table public.posts enable row level security;
|
||||
|
||||
-- ── Dialog / Diskussionen ───────────────────────────────────────────────
|
||||
-- Thread = Pfad des Beitrags (z.B. /library/software/stack/). Flache Wortmeldungen
|
||||
-- mit optionalem Bezug (parent_id). Idempotent — auf bestehende DB anwendbar.
|
||||
create table if not exists public.comments (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
thread text not null,
|
||||
parent_id uuid references public.comments(id) on delete cascade,
|
||||
user_id uuid,
|
||||
author_name text,
|
||||
author_avatar text,
|
||||
body text not null,
|
||||
created_at timestamptz not null default now(),
|
||||
deleted boolean not null default false
|
||||
);
|
||||
create index if not exists comments_thread_idx on public.comments (thread, created_at);
|
||||
alter table public.comments enable row level security;
|
||||
grant all on public.comments to anon, authenticated, service_role;
|
||||
|
||||
Reference in New Issue
Block a user