feat: Tier 1 & 2 — Daily Note, Voice, Flashcard quota, Readwise, Calendar, Agent Gallery
Tier 1: - BASIC tier: chat (10/mo) + reformulate (10/mo) désormais accessibles - Nouveaux quotas: ai_flashcard + voice_transcribe dans tous les tiers - /api/notes/daily : note du jour auto-créée (find or create) - Bouton Note du Jour dans la sidebar (CalendarDays) - Voice-to-Text dans l'éditeur (Web Speech API, bouton Mic toolbar) - Flashcard generation → quota ai_flashcard (au lieu de reformulate) Tier 2: - Intégration Readwise: GET/POST/DELETE /api/integrations/readwise - Intégration Google Calendar: OAuth flow + today's events + meeting notes - /api/integrations/calendar + /callback - Page /settings/integrations avec cards Calendar + Readwise - SettingsNav: onglet Intégrations - AgentTemplates: catégories + 4 nouveaux templates (Digest/Recap/AutoTagger/Synthesis) Schema: - UserAISettings.integrationTokens Json? (migration 20260529160000) - prisma generate + migrate deploy appliqués Fix: - SpeechRecognition types (triple-slash @types/dom-speech-recognition) - Notebook.create: suppression champ 'description' inexistant Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
64
memento-note/app/api/notes/daily/route.ts
Normal file
64
memento-note/app/api/notes/daily/route.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { auth } from '@/auth'
|
||||
import prisma from '@/lib/prisma'
|
||||
|
||||
function getTodayTitle(): string {
|
||||
return new Date().toISOString().slice(0, 10) // YYYY-MM-DD
|
||||
}
|
||||
|
||||
function getTodayContent(dateStr: string): string {
|
||||
const d = new Date(dateStr)
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
}
|
||||
const formatted = d.toLocaleDateString('fr-FR', options)
|
||||
return JSON.stringify({
|
||||
type: 'doc',
|
||||
content: [
|
||||
{ type: 'heading', attrs: { level: 1 }, content: [{ type: 'text', text: `📅 ${formatted}` }] },
|
||||
{ type: 'paragraph', content: [{ type: 'text', text: '' }] },
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/notes/daily
|
||||
* Returns (or creates) today's daily note for the authenticated user.
|
||||
*/
|
||||
export async function GET() {
|
||||
const session = await auth()
|
||||
if (!session?.user?.id) {
|
||||
return NextResponse.json({ success: false, error: 'Unauthorized' }, { status: 401 })
|
||||
}
|
||||
|
||||
const today = getTodayTitle()
|
||||
const userId = session.user.id
|
||||
|
||||
// Try to find existing daily note for today
|
||||
let note = await prisma.note.findFirst({
|
||||
where: {
|
||||
userId,
|
||||
title: today,
|
||||
type: 'daily',
|
||||
trashedAt: null,
|
||||
},
|
||||
})
|
||||
|
||||
if (!note) {
|
||||
note = await prisma.note.create({
|
||||
data: {
|
||||
userId,
|
||||
title: today,
|
||||
content: getTodayContent(today),
|
||||
type: 'daily',
|
||||
color: '#FEF9C3', // yellow-100 — distinguishes daily notes visually
|
||||
labels: JSON.stringify(['daily']),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true, note })
|
||||
}
|
||||
Reference in New Issue
Block a user