API Dashboard Admin

This commit is contained in:
2025-01-30 14:40:16 +08:00
parent 22fa1e8bcd
commit d539678c1b
10 changed files with 292 additions and 35 deletions

View File

@@ -0,0 +1,31 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
try {
const data = await prisma.portofolio.count({
where: {
active: true
}
});
return NextResponse.json({
success: true,
message: "Data portofolio",
data: data
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error Get Count Portofolio Main Dashboard")
return NextResponse.json({
success: false,
message: "Error Get Count Portofolio Main Dashboard",
data: null
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}