feat(flashcards): révision SM-2, génération IA et page /revision
Some checks failed
CI / Lint, Test & Build (push) Failing after 32s
CI / Deploy production (on server) (push) Has been skipped

Livre US-FLASHCARDS avec decks, session de révision, stats et migration Prisma. Finalise le Web Clipper (i18n 15 langues) et corrige les erreurs ESLint bloquant la CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Antigravity
2026-05-24 19:22:20 +00:00
parent 8697ae244f
commit 36336e6b0d
50 changed files with 7687 additions and 98 deletions

View File

@@ -0,0 +1,74 @@
-- CreateTable
CREATE TABLE "FlashcardDeck" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"notebookId" TEXT,
"name" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "FlashcardDeck_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Flashcard" (
"id" TEXT NOT NULL,
"deckId" TEXT NOT NULL,
"noteId" TEXT,
"front" TEXT NOT NULL,
"back" TEXT NOT NULL,
"type" TEXT NOT NULL DEFAULT 'qa',
"interval" INTEGER NOT NULL DEFAULT 1,
"easinessFactor" DOUBLE PRECISION NOT NULL DEFAULT 2.5,
"nextReviewAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Flashcard_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "FlashcardReview" (
"id" TEXT NOT NULL,
"cardId" TEXT NOT NULL,
"grade" INTEGER NOT NULL,
"reviewedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "FlashcardReview_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "FlashcardDeck_notebookId_key" ON "FlashcardDeck"("notebookId");
-- CreateIndex
CREATE INDEX "FlashcardDeck_userId_idx" ON "FlashcardDeck"("userId");
-- CreateIndex
CREATE INDEX "Flashcard_deckId_idx" ON "Flashcard"("deckId");
-- CreateIndex
CREATE INDEX "Flashcard_noteId_idx" ON "Flashcard"("noteId");
-- CreateIndex
CREATE INDEX "Flashcard_nextReviewAt_idx" ON "Flashcard"("nextReviewAt");
-- CreateIndex
CREATE INDEX "FlashcardReview_cardId_idx" ON "FlashcardReview"("cardId");
-- CreateIndex
CREATE INDEX "FlashcardReview_reviewedAt_idx" ON "FlashcardReview"("reviewedAt");
-- AddForeignKey
ALTER TABLE "FlashcardDeck" ADD CONSTRAINT "FlashcardDeck_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "FlashcardDeck" ADD CONSTRAINT "FlashcardDeck_notebookId_fkey" FOREIGN KEY ("notebookId") REFERENCES "Notebook"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Flashcard" ADD CONSTRAINT "Flashcard_deckId_fkey" FOREIGN KEY ("deckId") REFERENCES "FlashcardDeck"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Flashcard" ADD CONSTRAINT "Flashcard_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "FlashcardReview" ADD CONSTRAINT "FlashcardReview_cardId_fkey" FOREIGN KEY ("cardId") REFERENCES "Flashcard"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -54,6 +54,7 @@ model User {
noteClusters NoteCluster[]
bridgeNotes BridgeNote[]
bridgeSuggestions BridgeSuggestion[]
flashcardDecks FlashcardDeck[]
}
model Account {
@@ -111,6 +112,7 @@ model Notebook {
children Notebook[] @relation("NotebookTree")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
workflows Workflow[]
flashcardDeck FlashcardDeck?
@@index([userId, order])
@@index([userId])
@@ -195,6 +197,7 @@ model Note {
bridgeNote BridgeNote?
sourceLiveBlocks LiveBlockRef[] @relation("SourceLiveBlocks")
targetLiveBlocks LiveBlockRef[] @relation("TargetLiveBlocks")
flashcards Flashcard[]
@@index([isPinned])
@@index([isArchived])
@@ -855,3 +858,49 @@ model BridgeSuggestion {
@@index([userId, isDismissed])
@@index([clusterAId, clusterBId])
}
model FlashcardDeck {
id String @id @default(cuid())
userId String
notebookId String? @unique
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
flashcards Flashcard[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
notebook Notebook? @relation(fields: [notebookId], references: [id], onDelete: SetNull)
@@index([userId])
}
model Flashcard {
id String @id @default(cuid())
deckId String
noteId String?
front String
back String
type String @default("qa")
interval Int @default(1)
easinessFactor Float @default(2.5)
nextReviewAt DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deck FlashcardDeck @relation(fields: [deckId], references: [id], onDelete: Cascade)
note Note? @relation(fields: [noteId], references: [id], onDelete: SetNull)
reviews FlashcardReview[]
@@index([deckId])
@@index([noteId])
@@index([nextReviewAt])
}
model FlashcardReview {
id String @id @default(cuid())
cardId String
grade Int
reviewedAt DateTime @default(now())
card Flashcard @relation(fields: [cardId], references: [id], onDelete: Cascade)
@@index([cardId])
@@index([reviewedAt])
}