import { NextResponse } from 'next/server' import { prisma } from '@/lib/prisma' export async function GET( request: Request, { params }: { params: { cid: string } } ) { try { const sessions = await prisma.controllerSession.findMany({ where: { cid: params.cid, }, orderBy: { lastSeen: 'desc', }, }) return NextResponse.json(sessions) } catch (error) { console.error('Failed to fetch controller sessions:', error) return NextResponse.json({ error: 'Failed to fetch controller sessions' }, { status: 500 }) } }