fix event admin

This commit is contained in:
2025-02-03 12:34:13 +08:00
parent 795bda6914
commit b03f242af4
13 changed files with 331 additions and 160 deletions

View File

@@ -85,7 +85,6 @@ export async function GET(
},
});
await prisma.$disconnect();
return NextResponse.json({
success: true,
message: "Success create sponsor",
@@ -93,7 +92,6 @@ export async function GET(
});
} catch (error) {
backendLogger.error("Error get sponsor event", error);
await prisma.$disconnect();
return NextResponse.json(
{
success: false,
@@ -102,5 +100,7 @@ export async function GET(
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}

View File

@@ -0,0 +1,39 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json(
{ success: false, message: "Method not allowed" },
{ status: 405 }
);
}
try {
const data = await prisma.eventMaster_TipeAcara.findMany({
orderBy: {
id: "asc",
},
});
return NextResponse.json({
success: true,
message: "Success get tipe acara",
data: data,
});
} catch (error) {
backendLogger.error("Error get tipe acara", error);
return NextResponse.json(
{
success: false,
message: "Failed get tipe acara ",
reason: (error as Error).message,
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}