"use strict";(()=>{var e={};e.id=1034,e.ids=[1034],e.modules={53524:e=>{e.exports=require("@prisma/client")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},30042:(e,r,t)=>{t.r(r),t.d(r,{headerHooks:()=>m,originalPathname:()=>y,requestAsyncStorage:()=>l,routeModule:()=>p,serverHooks:()=>g,staticGenerationAsyncStorage:()=>P,staticGenerationBailout:()=>A});var a={};t.r(a),t.d(a,{DELETE:()=>u,PUT:()=>d}),t(95655);var o=t(83323),i=t(54647),n=t(66886),s=t(30953);async function d(e,{params:r}){try{let{id:t}=r,a=await e.json(),{nameEn:o,nameFr:i,descriptionEn:d,descriptionFr:u,image:c,slug:p}=a,l=await s._.category.update({where:{id:r.id},data:{nameEn:o,nameFr:i,descriptionEn:d,descriptionFr:u,image:c,slug:p}});return n.Z.json(l)}catch(e){return console.error("Error updating category:",e),n.Z.json({error:"Failed to update category"},{status:500})}}async function u(e,{params:r}){try{let{id:e}=r,t=await s._.product.count({where:{categoryId:e}});if(t>0)return n.Z.json({error:"Cannot delete category with associated products"},{status:400});return await s._.category.delete({where:{id:e}}),n.Z.json({success:!0})}catch(e){return console.error("Error deleting category:",e),n.Z.json({error:"Failed to delete category"},{status:500})}}let c=o.AppRouteRouteModule,p=new c({definition:{kind:i.x.APP_ROUTE,page:"/api/admin/categories/[id]/route",pathname:"/api/admin/categories/[id]",filename:"route",bundlePath:"app/api/admin/categories/[id]/route"},resolvedPagePath:".\\app\\api\\admin\\categories\\[id]\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:l,staticGenerationAsyncStorage:P,serverHooks:g,headerHooks:m,staticGenerationBailout:A}=p,y="/api/admin/categories/[id]/route"},30953:(e,r,t)=>{t.d(r,{_:()=>i});var a=t(53524);let o=globalThis,i=o.prisma??new a.PrismaClient},54647:(e,r)=>{var t;Object.defineProperty(r,"x",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE"}(t||(t={}))}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[9727,3497,6886],()=>t(30042));module.exports=a})();