minir fix

This commit is contained in:
dimitar committed 2025-11-19 05:07:14 +01:00
1 parent a87b94219d
commit 4909815807
5 files changed
+14 -4

No files matched your search

Binary file not shown.
@@ -10,7 +10,7 @@ export async function GET(req: Request) {
const db = await getDatabase()
const user = await db.getUserById(userId)
if (!user || user.role !== 'admin') {
if (!user || (user.role !== 'admin' && user.role !== 'superAdmin')) {
return new NextResponse('Forbidden', { status: 403 })
}
@@ -8,6 +8,12 @@ export async function GET() {
if (!userId) return new NextResponse('Unauthorized', { status: 401 })
const db = await getDatabase()
const user = await db.getUserById(userId)
if (!user || (user.role !== 'admin' && user.role !== 'superAdmin')) {
return new NextResponse('Forbidden', { status: 403 })
}
const stats = await db.getDashboardStats()
return NextResponse.json(stats)