feat: MVP-3 Sprint 4 - Co-usage, metrics, centrality, creation source, feature flags

- Add NoteCoUsage model and co-usage tracking when viewing notes
- Add creationSource field to notes (form/quick/import)
- Add dashboard metrics API (/api/metrics)
- Add centrality calculation (/api/centrality)
- Add feature flags system for toggling features
- Add multiline QuickAdd with smart paste type detection
- Add internal link suggestions while editing notes
- Add type inference for automatic note type detection
- Add comprehensive tests for type-inference and link-suggestions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 16:50:40 -03:00
parent ef0aebf510
commit ff7223bfea
20 changed files with 1388 additions and 54 deletions

View File

@@ -8,18 +8,21 @@ datasource db {
}
model Note {
id String @id @default(cuid())
title String
content String
type String @default("note")
isFavorite Boolean @default(false)
isPinned Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tags NoteTag[]
backlinks Backlink[] @relation("BacklinkTarget")
outbound Backlink[] @relation("BacklinkSource")
usageEvents NoteUsage[]
id String @id @default(cuid())
title String
content String
type String @default("note")
isFavorite Boolean @default(false)
isPinned Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
creationSource String @default("form") // 'form' | 'quick' | 'import'
tags NoteTag[]
backlinks Backlink[] @relation("BacklinkTarget")
outbound Backlink[] @relation("BacklinkSource")
usageEvents NoteUsage[]
coUsageFrom NoteCoUsage[] @relation("CoUsageFrom")
coUsageTo NoteCoUsage[] @relation("CoUsageTo")
}
model Tag {
@@ -60,3 +63,18 @@ model NoteUsage {
@@index([noteId, createdAt])
@@index([eventType, createdAt])
}
model NoteCoUsage {
id String @id @default(cuid())
fromNoteId String
fromNote Note @relation("CoUsageFrom", fields: [fromNoteId], references: [id], onDelete: Cascade)
toNoteId String
toNote Note @relation("CoUsageTo", fields: [toNoteId], references: [id], onDelete: Cascade)
weight Int @default(1) // times viewed together
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([fromNoteId, toNoteId])
@@index([fromNoteId])
@@index([toNoteId])
}