"use strict";(()=>{var e={};e.id=6069,e.ids=[6069],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")},32962:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>w,patchFetch:()=>x,requestAsyncStorage:()=>l,routeModule:()=>p,serverHooks:()=>h,staticGenerationAsyncStorage:()=>f});var i={};r.r(i),r.d(i,{GET:()=>d,PUT:()=>c});var a=r(49303),n=r(88716),o=r(60670),s=r(87070),u=r(72331);async function d(e){try{let{searchParams:t}=new URL(e.url),r=t.get("userId");if(!r)return s.NextResponse.json({error:"UserId is required"},{status:400});let i=await u._.notification.findMany({where:{userId:r},orderBy:{createdAt:"desc"},take:50}),a=await u._.notification.count({where:{userId:r,isRead:!1}});return s.NextResponse.json({notifications:i,unreadCount:a})}catch(e){return console.error("Failed to fetch notifications:",e),s.NextResponse.json({error:"Internal Server Error"},{status:500})}}async function c(e){try{let{userId:t,notificationId:r,action:i}=await e.json();if(!t)return s.NextResponse.json({error:"UserId is required"},{status:400});if("mark_all_read"===i)await u._.notification.updateMany({where:{userId:t,isRead:!1},data:{isRead:!0}});else if(r){let e=await u._.notification.findUnique({where:{id:r}});e&&e.userId===t&&await u._.notification.update({where:{id:r},data:{isRead:!0}})}return s.NextResponse.json({success:!0})}catch(e){return console.error("Failed to update notification:",e),s.NextResponse.json({error:"Internal Server Error"},{status:500})}}let p=new a.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/user/notifications/route",pathname:"/api/user/notifications",filename:"route",bundlePath:"app/api/user/notifications/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\user\\notifications\\route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:l,staticGenerationAsyncStorage:f,serverHooks:h}=p,w="/api/user/notifications/route";function x(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:f})}},72331:(e,t,r)=>{r.d(t,{_:()=>a});var i=r(53524);let a=global.prisma||new i.PrismaClient}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[8948,5972],()=>r(32962));module.exports=i})();