36 lines
978 B
TypeScript
Raw Normal View History

2025-04-11 17:35:06 +02:00
import { NextResponse, NextRequest } from "next/server";
2025-04-13 21:10:17 +02:00
import { prisma } from "@/lib/prisma";
2025-04-11 17:35:06 +02:00
interface AddRequest {
2025-04-12 13:19:52 +02:00
serverId: number;
2025-04-11 17:35:06 +02:00
name: string;
description: string;
icon: string;
publicURL: string;
localURL: string;
uptimecheckUrl: string;
2025-04-11 17:35:06 +02:00
}
export async function POST(request: NextRequest) {
try {
const body: AddRequest = await request.json();
const { serverId, name, description, icon, publicURL, localURL, uptimecheckUrl } = body;
2025-04-11 17:35:06 +02:00
const application = await prisma.application.create({
data: {
2025-04-12 13:19:52 +02:00
serverId,
2025-04-11 17:35:06 +02:00
name,
description,
icon,
publicURL,
localURL,
uptimecheckUrl
2025-04-11 17:35:06 +02:00
}
});
return NextResponse.json({ message: "Success", application });
} catch (error: any) {
return NextResponse.json({ error: error.message }, { status: 500 });
}
}