import { NextRequest, NextResponse } from 'next/server' import prisma from '@/lib/prisma' import { getMobileUserId } from '@/lib/mobile-auth' export async function GET( req: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const userId = getMobileUserId(req) if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 }) const { id } = await params const note = await prisma.note.findFirst({ where: { id, userId, trashedAt: null }, select: { id: true, title: true, content: true, updatedAt: true, createdAt: true, color: true, notebook: { select: { id: true, name: true } }, }, }) if (!note) return NextResponse.json({ error: 'Note introuvable' }, { status: 404 }) return NextResponse.json({ note }) }