"use strict";(()=>{var e={};e.id=3399,e.ids=[3399],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")},9003:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>U,patchFetch:()=>g,requestAsyncStorage:()=>x,routeModule:()=>m,serverHooks:()=>w,staticGenerationAsyncStorage:()=>f});var n={};t.r(n),t.d(n,{DELETE:()=>c,GET:()=>p,POST:()=>d});var a=t(49303),s=t(88716),i=t(60670),o=t(87070),u=t(72331);async function l(e){let{searchParams:r}=new URL(e.url),t=r.get("userId")||e.headers.get("x-user-id");if(!t)return!1;let n=await u._.user.findUnique({where:{id:t}});return n?.role==="ADMIN"}async function p(e){if(!await l(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});let r=await u._.banner.findMany({orderBy:{order:"asc"}});return o.NextResponse.json(r)}async function d(e){if(!await l(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});let r=await e.json(),t={title:r.title,imageUrl:r.imageUrl||"",linkUrl:r.linkUrl||null,scriptHtml:r.scriptHtml||null,videoUrl:r.videoUrl||null,placement:r.placement||"HOME_TOP",type:r.type||"BANNER_IMAGE",targetUser:r.targetUser||"ALL",isActive:"boolean"!=typeof r.isActive||r.isActive,order:"number"==typeof r.order?r.order:0},n=await u._.banner.create({data:t});return o.NextResponse.json(n)}async function c(e){if(!await l(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});let{searchParams:r}=new URL(e.url),t=r.get("id");return t?(await u._.banner.delete({where:{id:t}}),o.NextResponse.json({success:!0})):o.NextResponse.json({error:"ID required"},{status:400})}let m=new a.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/admin/banners/route",pathname:"/api/admin/banners",filename:"route",bundlePath:"app/api/admin/banners/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\admin\\banners\\route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:x,staticGenerationAsyncStorage:f,serverHooks:w}=m,U="/api/admin/banners/route";function g(){return(0,i.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:f})}},72331:(e,r,t)=>{t.d(r,{_:()=>a});var n=t(53524);let a=global.prisma||new n.PrismaClient}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),n=r.X(0,[8948,5972],()=>t(9003));module.exports=n})();