Mobile API Admin: Main dashboard, User Access, Super admin
Add: - api/mobile/admin/ ### No Issue
This commit is contained in:
39
src/app/api/mobile/admin/main-dashboard/route.ts
Normal file
39
src/app/api/mobile/admin/main-dashboard/route.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user