Files
hipmi/src/app/api/mobile/admin/main-dashboard/route.ts
nabillah 5287fb90bf Mobile API Admin: Main dashboard, User Access, Super admin
Add:
- api/mobile/admin/

### No Issue
2025-10-14 17:31:53 +08:00

40 lines
771 B
TypeScript

import { prisma } from "@/lib";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
let fixDAta;
try {
const user = await prisma.user.count({
where: {
active: true,
},
});
const portofolio = await prisma.portofolio.count({
where: {
active: true,
},
});
fixDAta = {
user: user,
portofolio: portofolio,
};
return NextResponse.json({
status: 200,
success: true,
message: "Success get data main dashboard",
data: fixDAta,
});
} catch (error) {
return NextResponse.json({
status: 500,
success: false,
message: "Error get data main dashboard",
reason: (error as Error).message,
});
}
}