import { NextRequest, NextResponse } from 'next/server' import prisma from '@/lib/prisma' import { getMobileUserId } from '@/lib/mobile-auth' export async function GET(req: NextRequest) { const userId = getMobileUserId(req) if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 }) const notebooks = await prisma.notebook.findMany({ where: { userId, trashedAt: null }, include: { _count: { select: { notes: { where: { trashedAt: null } } } } }, orderBy: { order: 'asc' }, }) return NextResponse.json({ notebooks }) }