import { NextRequest, NextResponse } from 'next/server' import { prisma } from '@/lib/prisma' import { getSession } from '@/lib/auth-simple' export async function GET(request: NextRequest) { const session = await getSession() if (!session) { return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) } const { searchParams } = new URL(request.url) const limit = parseInt(searchParams.get('limit') || '20') const offset = parseInt(searchParams.get('offset') || '0') const type = searchParams.get('type') const where: any = {} if (type) { where.type = type } const activities = await prisma.activity.findMany({ where, orderBy: { createdAt: 'desc' }, take: limit, skip: offset, include: { user: { select: { name: true } }, player: { select: { name: true } }, event: { select: { name: true } }, }, }) return NextResponse.json(activities) }