mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Edit APplications Function & Edit Application API Fixes
This commit is contained in:
@@ -5,6 +5,7 @@ interface EditRequest {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
serverId: number;
|
||||
icon: string;
|
||||
publicURL: string;
|
||||
localURL: string;
|
||||
@@ -13,16 +14,17 @@ interface EditRequest {
|
||||
export async function PUT(request: NextRequest) {
|
||||
try {
|
||||
const body: EditRequest = await request.json();
|
||||
const { id, name, description, icon, publicURL, localURL } = body;
|
||||
const { id, name, description, serverId, icon, publicURL, localURL } = body;
|
||||
|
||||
const existingServer = await prisma.server.findUnique({ where: { id } });
|
||||
if (!existingServer) {
|
||||
const existingApp = await prisma.application.findUnique({ where: { id } });
|
||||
if (!existingApp) {
|
||||
return NextResponse.json({ error: "Server not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const updatedApplication = await prisma.application.update({
|
||||
where: { id },
|
||||
data: {
|
||||
serverId,
|
||||
name,
|
||||
description,
|
||||
icon,
|
||||
|
||||
Reference in New Issue
Block a user