Add API Dashboard Forum & Job

This commit is contained in:
2025-02-03 14:01:30 +08:00
parent 91f61f99c5
commit e5f56772ee
9 changed files with 408 additions and 34 deletions

View File

@@ -0,0 +1,44 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function GET(request: Request, { params }: {
params: { status: string }
}) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json({
success: false,
message: "Method not allowed",
},
{ status: 405 }
)
}
try {
let fixData;
fixData = await prisma.forum_Posting.count({
where: {
isActive: true,
}
})
return NextResponse.json({
success: true,
message: "Success get data forum dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error get data forum dashboard", error);
return NextResponse.json({
success: false,
message: "Error get data forum dashboard",
reason: (error as Error).message
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}

View File

@@ -0,0 +1,41 @@
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 {
let fixData;
fixData = await prisma.forum_ReportKomentar.count({
where: {
isActive: true,
}
})
return NextResponse.json({
success: true,
message: "Success get data forum dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error get data forum dashboard", error);
return NextResponse.json({
success: false,
message: "Error get data forum dashboard",
reason: (error as Error).message
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}

View File

@@ -0,0 +1,41 @@
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 {
let fixData;
fixData = await prisma.forum_ReportPosting.count({
where: {
isActive: true,
}
})
return NextResponse.json({
success: true,
message: "Success get data forum dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error get data forum dashboard", error);
return NextResponse.json({
success: false,
message: "Error get data forum dashboard",
reason: (error as Error).message
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}