feat: 完成举报拉黑和审核处置闭环

This commit is contained in:
root
2026-09-16 20:41:01 +08:00
parent 02189ebb2e
commit ce8e1db279
19 changed files with 1778 additions and 5 deletions
@@ -0,0 +1,17 @@
CREATE TYPE "AccountRole" AS ENUM ('USER', 'ADMIN');
ALTER TABLE "accounts" ADD COLUMN "role" "AccountRole" NOT NULL DEFAULT 'USER';
ALTER TABLE "reports" ADD COLUMN "idempotency_key" VARCHAR(128) DEFAULT gen_random_uuid()::text;
UPDATE "reports" SET "idempotency_key" = "id"::text WHERE "idempotency_key" IS NULL;
ALTER TABLE "reports" ALTER COLUMN "idempotency_key" SET NOT NULL;
CREATE UNIQUE INDEX "reports_reporter_id_idempotency_key_key" ON "reports"("reporter_id", "idempotency_key");
ALTER TABLE "notifications" ADD COLUMN "dedupe_key" VARCHAR(255);
UPDATE "notifications" SET "dedupe_key" = "id"::text WHERE "dedupe_key" IS NULL;
ALTER TABLE "notifications" ALTER COLUMN "dedupe_key" SET NOT NULL;
CREATE UNIQUE INDEX "notifications_account_id_dedupe_key_key" ON "notifications"("account_id", "dedupe_key");
CREATE TABLE "push_preferences" (
"account_id" UUID NOT NULL,
"in_app_enabled" BOOLEAN NOT NULL DEFAULT true,
"updated_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "push_preferences_pkey" PRIMARY KEY ("account_id"),
CONSTRAINT "push_preferences_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "accounts"("id") ON DELETE CASCADE ON UPDATE CASCADE
);