feat: MVP-3 Sprint 1 - Usage tracking, smart dashboard, scoring boost

## Registro de Uso
- Nuevo modelo NoteUsage en Prisma
- Tipos de eventos: view, search_click, related_click, link_click, copy_command, copy_snippet
- Funciones: trackNoteUsage, getUsageStats, getRecentlyUsedNotes
- localStorage: recentlyViewed (últimas 10 notas)
- Rastreo de copias en markdown-content.tsx

## Dashboard Rediseñado
- 5 bloques: Recientes, Más usadas, Comandos recientes, Snippets recientes, Según actividad
- Nuevo src/lib/dashboard.ts con getDashboardData()
- Recomendaciones basadas en recentlyViewed

## Scoring con Uso Real
- search.ts: +1 per 5 views (max +3), +2 recency boost
- related.ts: mismo sistema de usage boost
- No eclipsa match textual fuerte

## Tests
- 110 tests pasando (usage, dashboard, related, search)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 16:03:14 -03:00
parent cc4b2453b1
commit 05b8f3910d
16 changed files with 2038 additions and 73 deletions

View File

@@ -19,6 +19,7 @@ model Note {
tags NoteTag[]
backlinks Backlink[] @relation("BacklinkTarget")
outbound Backlink[] @relation("BacklinkSource")
usageEvents NoteUsage[]
}
model Tag {
@@ -46,3 +47,16 @@ model Backlink {
@@unique([sourceNoteId, targetNoteId])
}
model NoteUsage {
id String @id @default(cuid())
noteId String
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
eventType String // 'view' | 'search_click' | 'related_click' | 'link_click'
query String?
metadata String?
createdAt DateTime @default(now())
@@index([noteId, createdAt])
@@index([eventType, createdAt])
}