import { NextResponse } from 'next/server'; import { prisma } from '@/lib/db/prisma'; export async function GET(request: Request) { const { searchParams } = new URL(request.url); const district = searchParams.get('district'); const shelters = await prisma.shelter.findMany({ where: { verified: true, ...(district && { district: { contains: district, mode: 'insensitive' }, }), }, select: { id: true, name: true, district: true, address: true, phone: true, email: true, description: true, website: true, openHours: true, _count: { select: { animals: { where: { status: 'AVAILABLE' } } } }, }, orderBy: { name: 'asc' }, }); return NextResponse.json(shelters); }