remove unused admin users and stats API routes

This commit is contained in:
Yusuf İpek
2026-02-24 18:13:14 +03:00
parent 59b766d071
commit 191b352520
2 changed files with 0 additions and 92 deletions
-58
View File
@@ -1,58 +0,0 @@
import { NextResponse } from 'next/server';
import { db } from '@/lib/db';
import { auth } from '@/lib/auth';
import { getCachedTotalStorage } from '@/lib/admin-stats';
export async function GET() {
try {
const session = await auth();
if (!session?.user?.isAdmin) {
return new NextResponse('Unauthorized', { status: 403 });
}
// 1. Database Stats
const [
totalUsers,
totalProjects,
totalVideos,
totalComments,
totalVoiceComments,
totalImageComments,
] = await Promise.all([
db.user.count(),
db.project.count(),
db.video.count(),
db.comment.count(),
db.comment.count({
where: {
voiceUrl: {
not: null,
}
}
}),
db.comment.count({
where: {
imageUrl: {
not: null,
}
}
})
]);
// 2. Storage Stats (Cached)
const totalStorageBytes = await getCachedTotalStorage();
return NextResponse.json({
totalUsers,
totalProjects,
totalVideos,
totalComments,
totalVoiceComments,
totalImageComments,
totalStorageBytes,
});
} catch (error) {
console.error('[ADMIN_STATS_GET]', error);
return new NextResponse('Internal Error', { status: 500 });
}
}