Implement News System with Admin UI and Homepage Integration
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "News" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"title" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"author" TEXT,
|
||||
"publishedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"featured" BOOLEAN NOT NULL DEFAULT false,
|
||||
"specialId" INTEGER,
|
||||
CONSTRAINT "News_specialId_fkey" FOREIGN KEY ("specialId") REFERENCES "Special" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "News_publishedAt_idx" ON "News"("publishedAt");
|
||||
@@ -47,6 +47,7 @@ model Special {
|
||||
curator String?
|
||||
songs SpecialSong[]
|
||||
puzzles DailyPuzzle[]
|
||||
news News[]
|
||||
}
|
||||
|
||||
model SpecialSong {
|
||||
@@ -73,3 +74,17 @@ model DailyPuzzle {
|
||||
|
||||
@@unique([date, genreId, specialId])
|
||||
}
|
||||
|
||||
model News {
|
||||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
content String // Markdown format
|
||||
author String? // Optional: curator/admin name
|
||||
publishedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
featured Boolean @default(false) // Highlight important news
|
||||
specialId Int? // Optional: link to a special
|
||||
special Special? @relation(fields: [specialId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([publishedAt])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user