feat: implement song rating system with admin view and user persistence

This commit is contained in:
Hördle Bot
2025-11-23 10:34:45 +01:00
parent dc83c8372f
commit 4d3032df36
7 changed files with 191 additions and 11 deletions

View File

@@ -0,0 +1,21 @@
-- AlterTable
ALTER TABLE "Special" ADD COLUMN "curator" TEXT;
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Song" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"artist" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"coverImage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"averageRating" REAL NOT NULL DEFAULT 0,
"ratingCount" INTEGER NOT NULL DEFAULT 0
);
INSERT INTO "new_Song" ("artist", "coverImage", "createdAt", "filename", "id", "title") SELECT "artist", "coverImage", "createdAt", "filename", "id", "title" FROM "Song";
DROP TABLE "Song";
ALTER TABLE "new_Song" RENAME TO "Song";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -20,6 +20,8 @@ model Song {
puzzles DailyPuzzle[]
genres Genre[]
specials SpecialSong[]
averageRating Float @default(0)
ratingCount Int @default(0)
}
model Genre {