mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
20c8fb0898
Introduce user-reported-issues and Goodreads shelf sync features and wire them into notifications. Adds Prisma migrations and schema changes (ReportedIssue, GoodreadsShelf, GoodreadsBookMapping), API endpoints for reporting (POST /audiobooks/[asin]/report-issue) and admin management (list, resolve/dismiss, replace), and an admin UI section to view/dismiss/replace reported issues. Adds a new notification event (issue_reported) with updates to notification schemas, docs and provider handling, plus a notification-events constants file. Refactors request creation to use createRequestForUser service, adds a Goodreads sync processor/service/hooks/UI modals, a scrape-resilience util, and related tests and minor integration updates.
33 lines
1.3 KiB
SQL
33 lines
1.3 KiB
SQL
-- CreateTable
|
|
CREATE TABLE "reported_issues" (
|
|
"id" TEXT NOT NULL,
|
|
"audiobook_id" TEXT NOT NULL,
|
|
"reporter_id" TEXT NOT NULL,
|
|
"reason" VARCHAR(250) NOT NULL,
|
|
"status" TEXT NOT NULL DEFAULT 'open',
|
|
"resolved_at" TIMESTAMP(3),
|
|
"resolved_by_id" TEXT,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "reported_issues_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "reported_issues_audiobook_id_idx" ON "reported_issues"("audiobook_id");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "reported_issues_reporter_id_idx" ON "reported_issues"("reporter_id");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "reported_issues_status_idx" ON "reported_issues"("status");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "reported_issues" ADD CONSTRAINT "reported_issues_audiobook_id_fkey" FOREIGN KEY ("audiobook_id") REFERENCES "audiobooks"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "reported_issues" ADD CONSTRAINT "reported_issues_reporter_id_fkey" FOREIGN KEY ("reporter_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "reported_issues" ADD CONSTRAINT "reported_issues_resolved_by_id_fkey" FOREIGN KEY ("resolved_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|