Files
Momento/memento-note/app/api/brainstorm/[sessionId]/activity/route.ts
Antigravity 1fcea6ed7d
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 7s
feat: brainstorm sessions, PDF document Q&A, embedding fixes, and UI improvements
- Add brainstorm feature with collaborative canvas, AI idea generation, live cursors, playback, and export
- Add PDF upload/extraction/ingestion pipeline with pgvector document search (RAG)
- Add document Q&A overlay with streaming chat and PDF preview
- Add note attachments UI with status polling, grid layout, and auto-scroll
- Add task extraction AI tool and agent executor improvements
- Fix NoteEmbedding missing updatedAt column, re-index 66 notes with 1536-dim embeddings
- Fix brainstorm 'Create Note' button: add success toast and redirect to created note
- Fix memory echo notification infinite polling
- Fix chat route to always include document_search tool
- Add brainstorm i18n keys across all 14 locales
- Add socket server for real-time brainstorm collaboration
- Add hierarchical notebook selector and organize notebook dialog improvements
- Add sidebar brainstorm section with session management
- Update prisma schema with brainstorm tables, attachments, and document chunks
2026-05-14 17:43:21 +00:00

47 lines
1.4 KiB
TypeScript

import { NextRequest, NextResponse } from 'next/server'
import prisma from '@/lib/prisma'
import { auth } from '@/auth'
import { verifyParticipant } from '@/lib/brainstorm-collab'
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ sessionId: string }> }
) {
const session = await auth()
if (!session?.user?.id) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}
try {
const { sessionId } = await params
const { isParticipant } = await verifyParticipant(sessionId, session.user.id)
if (!isParticipant) {
return NextResponse.json({ error: 'Not a participant' }, { status: 403 })
}
const activities = await prisma.brainstormActivity.findMany({
where: { sessionId },
orderBy: { createdAt: 'desc' },
take: 50,
include: {
user: { select: { id: true, name: true, image: true } },
},
})
return NextResponse.json({
success: true,
data: activities.map(a => ({
id: a.id,
action: a.action,
details: a.details ? JSON.parse(a.details) : null,
createdAt: a.createdAt,
user: a.user ? { name: a.user.name, image: a.user.image } : null,
})),
})
} catch (error) {
console.error('Error fetching activity:', error)
return NextResponse.json({ error: 'Failed to fetch activity' }, { status: 500 })
}
}