"use strict";(()=>{var e={};e.id=6553,e.ids=[6553],e.modules={53524:e=>{e.exports=require("@prisma/client")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},73419:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>v,requestAsyncStorage:()=>l,routeModule:()=>c,serverHooks:()=>h,staticGenerationAsyncStorage:()=>m});var a={};r.r(a),r.d(a,{GET:()=>p,dynamic:()=>d});var s=r(49303),n=r(88716),o=r(60670),i=r(87070),u=r(72331);let d="force-dynamic";async function p(){try{let[e,t,r,a,s]=await Promise.all([u._.user.count(),u._.user.count({where:{vipLevel:{gt:0}}}),u._.transaction.aggregate({_sum:{amount:!0},where:{status:"SUCCESS",type:{in:["TOPUP","VIP_PURCHASE"]}}}),u._.user.findMany({take:5,orderBy:{createdAt:"desc"},select:{id:!0,username:!0,email:!0,image:!0,createdAt:!0,role:!0}}),u._.transaction.findMany({take:5,where:{status:"SUCCESS"},orderBy:{createdAt:"desc"},include:{user:{select:{username:!0,image:!0}}}})]);return i.NextResponse.json({totalUsers:e,vipUsers:t,totalRevenue:r._sum.amount||0,recentUsers:a,recentTransactions:s})}catch(e){return console.error("Dashboard Stats Error:",e),i.NextResponse.json({error:"Failed to fetch dashboard stats"},{status:500})}}let c=new s.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/admin/stats/route",pathname:"/api/admin/stats",filename:"route",bundlePath:"app/api/admin/stats/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\admin\\stats\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:l,staticGenerationAsyncStorage:m,serverHooks:h}=c,g="/api/admin/stats/route";function v(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:m})}},72331:(e,t,r)=>{r.d(t,{_:()=>s});var a=r(53524);let s=global.prisma||new a.PrismaClient}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,5972],()=>r(73419));module.exports=a})();