export const dynamic = 'force-dynamic';

import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';

export async function GET() {
  try {
    const testimonials = await prisma.testimonial.findMany({
      orderBy: { createdAt: 'desc' },
    });
    return NextResponse.json(testimonials ?? []);
  } catch (error: any) {
    console.error('Testimonials fetch error:', error);
    return NextResponse.json([], { status: 200 });
  }
}
