mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
cc8e106a2b
Introduce per-user configurable home page sections and a unified Audible cache/category model. Adds Prisma models (UserHomeSection, AudibleCacheCategory) and migrations to create tables and remove legacy popular/new_release flags; updates schema.prisma accordingly. Add API routes for user home sections, live Audible categories, and category-based audiobook listing, and refactor popular/new-releases/covers routes to read from AudibleCacheCategory. Frontend: new HomeSection component, HomeSectionConfigModal, useHomeSections hook, and homepage changes to render dynamic sections plus image fallback to a placeholder SVG. Also add placeholder_cover.svg and tests for home sections and the audible refresh processor.
50 lines
1.8 KiB
SQL
50 lines
1.8 KiB
SQL
-- CreateTable
|
|
CREATE TABLE "user_home_sections" (
|
|
"id" TEXT NOT NULL,
|
|
"user_id" TEXT NOT NULL,
|
|
"section_type" TEXT NOT NULL,
|
|
"category_id" TEXT,
|
|
"category_name" TEXT,
|
|
"sort_order" INTEGER NOT NULL,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "user_home_sections_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "audible_cache_categories" (
|
|
"id" TEXT NOT NULL,
|
|
"asin" TEXT NOT NULL,
|
|
"category_id" TEXT NOT NULL,
|
|
"rank" INTEGER NOT NULL,
|
|
"last_synced_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "audible_cache_categories_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "user_home_sections_user_id_idx" ON "user_home_sections"("user_id");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "user_home_sections_sort_order_idx" ON "user_home_sections"("sort_order");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "user_home_sections_user_id_section_type_category_id_key" ON "user_home_sections"("user_id", "section_type", "category_id");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "audible_cache_categories_category_id_idx" ON "audible_cache_categories"("category_id");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "audible_cache_categories_asin_idx" ON "audible_cache_categories"("asin");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "audible_cache_categories_category_id_rank_idx" ON "audible_cache_categories"("category_id", "rank");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "audible_cache_categories_asin_category_id_key" ON "audible_cache_categories"("asin", "category_id");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "user_home_sections" ADD CONSTRAINT "user_home_sections_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|