20 lines
431 B
TypeScript
20 lines
431 B
TypeScript
import { prisma } from "@repo/db";
|
|
import { NextResponse } from "next/server";
|
|
|
|
export async function GET(): Promise<NextResponse> {
|
|
try {
|
|
const config = await prisma.config.findFirst({
|
|
orderBy: {
|
|
createdAt: "desc",
|
|
},
|
|
});
|
|
|
|
return NextResponse.json(config, {
|
|
status: 200,
|
|
});
|
|
} catch (error) {
|
|
console.error(error);
|
|
return NextResponse.json({ error: "Failed to fetch Aircrafts" }, { status: 500 });
|
|
}
|
|
}
|