- Under the summary, the detailed analyses, the forecast and tarot: "How tailored to you did it feel?" (1–5 stars); thumbs under answers. Only the owner rates, once (changeable); tags, a comment, and a permission to read the text; model and prompt version are kept with it - /visszajelzes: bug, idea, question, other (the page and the browser go with it, 10 a day); the state and the operator's reply show there, a dot in the account menu marks a new reply. No e-mail, no Telegram - One NPS question (0–10) in a bar under the header, after two finished contents; closing it counts - Admin → Visszajelzések: numbers by kind, week, tags, model and prompt, buyers and others, NPS; ratings with filters, the text only if allowed; messages with state, internal note and reply; a count in the admin menu - Nothing is public. Deleting an account keeps the stars without a name or comment; messages go. Privacy policy (hu, en) updated - The admin menu no longer shows a vertical scrollbar Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
72 lines
3.5 KiB
SQL
72 lines
3.5 KiB
SQL
-- Feedback, kept in the system only (no e-mail, no Telegram). Nothing of it
|
||
-- is shown publicly: these are not reviews.
|
||
|
||
-- Ratings of what a user got: the short summary, a detailed analysis, a
|
||
-- forecast, a synastry, a tarot reading (analyses), or an answer to a
|
||
-- question. Only the one who got it rates it, once (a rating can be
|
||
-- changed). Kind, model and prompt version are copied, so the statistics
|
||
-- stay when the analysis is deleted.
|
||
CREATE TABLE content_ratings (
|
||
id uuid PRIMARY KEY,
|
||
-- Cleared with the account (the comment goes too; the stars stay, without a name).
|
||
user_id uuid REFERENCES users (id) ON DELETE SET NULL,
|
||
analysis_id uuid REFERENCES analyses (id) ON DELETE SET NULL,
|
||
question_id uuid REFERENCES questions (id) ON DELETE SET NULL,
|
||
-- summary, natal, synastry, forecast, tarot or question.
|
||
kind text NOT NULL,
|
||
model text,
|
||
prompt_version text,
|
||
-- 1–5 stars; an answer's thumbs are 1 (down) or 5 (up).
|
||
stars smallint NOT NULL CHECK (stars BETWEEN 1 AND 5),
|
||
tags text[] NOT NULL DEFAULT '{}',
|
||
comment text,
|
||
-- The user lets the operator read the rated text (to improve it).
|
||
may_read boolean NOT NULL DEFAULT false,
|
||
-- Had paid for a package when rating.
|
||
buyer boolean NOT NULL DEFAULT false,
|
||
created_at timestamptz NOT NULL DEFAULT now(),
|
||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||
-- An admin has looked at it (the admin menu counts the ones to look at).
|
||
reviewed_at timestamptz,
|
||
CHECK (analysis_id IS NULL OR question_id IS NULL)
|
||
);
|
||
CREATE UNIQUE INDEX content_ratings_analysis_idx ON content_ratings (analysis_id, user_id)
|
||
WHERE analysis_id IS NOT NULL AND user_id IS NOT NULL;
|
||
CREATE UNIQUE INDEX content_ratings_question_idx ON content_ratings (question_id, user_id)
|
||
WHERE question_id IS NOT NULL AND user_id IS NOT NULL;
|
||
CREATE INDEX content_ratings_created_idx ON content_ratings (created_at DESC);
|
||
|
||
-- Messages through the "Visszajelzés" page: bugs, ideas, questions. The
|
||
-- user sees their state and the operator's reply on the same page.
|
||
CREATE TABLE feedback_messages (
|
||
id uuid PRIMARY KEY,
|
||
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
||
category text NOT NULL CHECK (category IN ('bug', 'idea', 'question', 'other')),
|
||
body text NOT NULL,
|
||
-- The page the user came from, and the browser (for bugs).
|
||
page text,
|
||
user_agent text,
|
||
status text NOT NULL DEFAULT 'new' CHECK (status IN ('new', 'in_progress', 'done', 'dismissed')),
|
||
-- Only the operator sees it.
|
||
admin_note text,
|
||
reply text,
|
||
replied_at timestamptz,
|
||
-- The user has seen the reply.
|
||
reply_seen_at timestamptz,
|
||
created_at timestamptz NOT NULL DEFAULT now(),
|
||
updated_at timestamptz NOT NULL DEFAULT now()
|
||
);
|
||
CREATE INDEX feedback_messages_status_idx ON feedback_messages (status, created_at DESC);
|
||
CREATE INDEX feedback_messages_user_idx ON feedback_messages (user_id, created_at DESC);
|
||
|
||
-- "How likely are you to recommend Sorsfonalak to a friend?" (0–10), asked
|
||
-- once in the app. A closed question is kept with no score: not asked again.
|
||
CREATE TABLE nps_answers (
|
||
id uuid PRIMARY KEY,
|
||
user_id uuid UNIQUE REFERENCES users (id) ON DELETE SET NULL,
|
||
score smallint CHECK (score BETWEEN 0 AND 10),
|
||
comment text,
|
||
buyer boolean NOT NULL DEFAULT false,
|
||
created_at timestamptz NOT NULL DEFAULT now()
|
||
);
|