feat(notes): vues structurées tableau/kanban, flashcards et MCP robuste
Ajoute la base organisable par carnet (schéma, champs partagés, valeurs par note) avec activation guidée, tableau éditable, kanban et suppression de colonnes. Corrige le multiselect en vue tableau et enrichit sidebar, grille et i18n FR/EN. Inclut aussi les améliorations flashcards SM-2, l'audit consentement IA et la robustesse du serveur MCP (config, validation, rate-limit, métriques). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
-- AiConsentLog (audit RGPD) + consentement persistant sur UserAISettings
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "AiConsentLog" (
|
||||
"id" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"consent" BOOLEAN NOT NULL DEFAULT true,
|
||||
"ipAddress" TEXT,
|
||||
"userAgent" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "AiConsentLog_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM pg_constraint WHERE conname = 'AiConsentLog_userId_fkey'
|
||||
) THEN
|
||||
ALTER TABLE "AiConsentLog"
|
||||
ADD CONSTRAINT "AiConsentLog_userId_fkey"
|
||||
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
ALTER TABLE "UserAISettings"
|
||||
ADD COLUMN IF NOT EXISTS "aiProcessingConsent" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -0,0 +1,59 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "NotebookSchema" (
|
||||
"id" TEXT NOT NULL,
|
||||
"notebookId" TEXT NOT NULL,
|
||||
"viewSettings" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "NotebookSchema_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "NotebookProperty" (
|
||||
"id" TEXT NOT NULL,
|
||||
"schemaId" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"options" TEXT,
|
||||
"position" INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT "NotebookProperty_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "NoteProperty" (
|
||||
"id" TEXT NOT NULL,
|
||||
"noteId" TEXT NOT NULL,
|
||||
"propertyId" TEXT NOT NULL,
|
||||
"value" TEXT,
|
||||
|
||||
CONSTRAINT "NoteProperty_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "NotebookSchema_notebookId_key" ON "NotebookSchema"("notebookId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NotebookProperty_schemaId_position_idx" ON "NotebookProperty"("schemaId", "position");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NoteProperty_noteId_idx" ON "NoteProperty"("noteId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NoteProperty_propertyId_idx" ON "NoteProperty"("propertyId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "NoteProperty_noteId_propertyId_key" ON "NoteProperty"("noteId", "propertyId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NotebookSchema" ADD CONSTRAINT "NotebookSchema_notebookId_fkey" FOREIGN KEY ("notebookId") REFERENCES "Notebook"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NotebookProperty" ADD CONSTRAINT "NotebookProperty_schemaId_fkey" FOREIGN KEY ("schemaId") REFERENCES "NotebookSchema"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NoteProperty" ADD CONSTRAINT "NoteProperty_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NoteProperty" ADD CONSTRAINT "NoteProperty_propertyId_fkey" FOREIGN KEY ("propertyId") REFERENCES "NotebookProperty"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -113,6 +113,7 @@ model Notebook {
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
workflows Workflow[]
|
||||
flashcardDeck FlashcardDeck?
|
||||
schema NotebookSchema?
|
||||
|
||||
@@index([userId, order])
|
||||
@@index([userId])
|
||||
@@ -198,6 +199,7 @@ model Note {
|
||||
sourceLiveBlocks LiveBlockRef[] @relation("SourceLiveBlocks")
|
||||
targetLiveBlocks LiveBlockRef[] @relation("TargetLiveBlocks")
|
||||
flashcards Flashcard[]
|
||||
properties NoteProperty[]
|
||||
|
||||
@@index([isPinned])
|
||||
@@index([isArchived])
|
||||
@@ -859,6 +861,42 @@ model BridgeSuggestion {
|
||||
@@index([clusterAId, clusterBId])
|
||||
}
|
||||
|
||||
model NotebookSchema {
|
||||
id String @id @default(cuid())
|
||||
notebookId String @unique
|
||||
viewSettings String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
notebook Notebook @relation(fields: [notebookId], references: [id], onDelete: Cascade)
|
||||
properties NotebookProperty[]
|
||||
}
|
||||
|
||||
model NotebookProperty {
|
||||
id String @id @default(cuid())
|
||||
schemaId String
|
||||
name String
|
||||
type String
|
||||
options String?
|
||||
position Int
|
||||
schema NotebookSchema @relation(fields: [schemaId], references: [id], onDelete: Cascade)
|
||||
noteValues NoteProperty[]
|
||||
|
||||
@@index([schemaId, position])
|
||||
}
|
||||
|
||||
model NoteProperty {
|
||||
id String @id @default(cuid())
|
||||
noteId String
|
||||
propertyId String
|
||||
value String?
|
||||
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
||||
property NotebookProperty @relation(fields: [propertyId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([noteId, propertyId])
|
||||
@@index([noteId])
|
||||
@@index([propertyId])
|
||||
}
|
||||
|
||||
model FlashcardDeck {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
|
||||
Reference in New Issue
Block a user