import { getServerSession } from 'next-auth'; import { authOptions } from '@/lib/auth'; import { prisma } from '@/lib/prisma'; import DashboardContent from '@/components/DashboardContent'; import DashboardSidebar from '@/components/DashboardSidebar'; export default async function DashboardPage() { const session = await getServerSession(authOptions); const stats = { totalBookings: await prisma.booking.count(), reservedBookings: await prisma.booking.count({ where: { status: 'RESERVED' }, }), confirmedBookings: await prisma.booking.count({ where: { status: 'CONFIRMED' }, }), completedBookings: await prisma.booking.count({ where: { status: 'COMPLETED' }, }), totalLocations: await prisma.location.count(), totalPhotoboxes: await prisma.photobox.count({ where: { active: true }, }), totalDrivers: await prisma.user.count({ where: { role: 'DRIVER', active: true }, }), }; const recentBookings = await prisma.booking.findMany({ take: 5, orderBy: { createdAt: 'desc' }, include: { location: true, photobox: true, }, }); return (
); }