Files
afrov2/app/api/one-shot-plans/route.ts

15 lines
422 B
TypeScript

import { prisma } from "@/lib/prisma";
import { NextResponse } from "next/server";
export async function GET() {
try {
const plans = await prisma.oneShotPlan.findMany({
orderBy: { type: 'asc' }
});
return NextResponse.json(plans);
} catch (error) {
console.error("Failed to fetch one-shot plans:", error);
return NextResponse.json({ error: "Failed to fetch plans" }, { status: 500 });
}
}