"use strict";(()=>{var e={};e.id=3985,e.ids=[3985],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")},63737:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>h,patchFetch:()=>f,requestAsyncStorage:()=>l,routeModule:()=>p,serverHooks:()=>x,staticGenerationAsyncStorage:()=>g});var n={};r.r(n),r.d(n,{DELETE:()=>d,GET:()=>u,dynamic:()=>c});var o=r(49303),s=r(88716),a=r(60670),i=r(87070),m=r(72331);let c="force-dynamic";async function u(e){try{let{searchParams:t}=new URL(e.url),r=parseInt(t.get("page")||"1"),n=parseInt(t.get("limit")||"20"),o=t.get("search"),s=(r-1)*n,a={};o&&(a.OR=[{content:{contains:o}},{user:{username:{contains:o}}}]);let[c,u]=await Promise.all([m._.comment.findMany({where:a,skip:s,take:n,orderBy:{createdAt:"desc"},include:{user:{select:{username:!0,image:!0}}}}),m._.comment.count({where:a})]);return i.NextResponse.json({comments:c,pagination:{page:r,limit:n,total:u,totalPages:Math.ceil(u/n)}})}catch(e){return console.error("Admin Comments API Error:",e),i.NextResponse.json({error:"Failed to fetch comments"},{status:500})}}async function d(e){try{let{searchParams:t}=new URL(e.url),r=t.get("id");if(!r)return i.NextResponse.json({error:"Comment ID required"},{status:400});return await m._.comment.delete({where:{id:r}}),i.NextResponse.json({success:!0})}catch(e){return console.error("Admin Delete Comment Error:",e),i.NextResponse.json({error:"Failed to delete comment"},{status:500})}}let p=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/admin/comments/route",pathname:"/api/admin/comments",filename:"route",bundlePath:"app/api/admin/comments/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\admin\\comments\\route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:l,staticGenerationAsyncStorage:g,serverHooks:x}=p,h="/api/admin/comments/route";function f(){return(0,a.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:g})}},72331:(e,t,r)=>{r.d(t,{_:()=>o});var n=r(53524);let o=global.prisma||new n.PrismaClient}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,5972],()=>r(63737));module.exports=n})();