"use strict";(()=>{var e={};e.id=2646,e.ids=[2646],e.modules={53524:e=>{e.exports=require("@prisma/client")},72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},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")},6113:e=>{e.exports=require("crypto")},6005:e=>{e.exports=require("node:crypto")},4328:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>y,patchFetch:()=>v,requestAsyncStorage:()=>f,routeModule:()=>h,serverHooks:()=>g,staticGenerationAsyncStorage:()=>x});var r={};s.r(r),s.d(r,{DELETE:()=>m,GET:()=>d,PATCH:()=>p,dynamic:()=>c});var n=s(49303),o=s(88716),i=s(60670),a=s(87070),u=s(13538),l=s(5710);let c="force-dynamic";async function d(e,{params:t}){try{let{userId:e}=(0,l.v0)();if(!e)return(0,l.Hs)();let s=await u.Z.schoolClub.findUnique({where:{id:t.id},include:{members:!0,events:!0}});if(!s)return a.NextResponse.json({message:"Club not found"},{status:404});return a.NextResponse.json(s)}catch(e){return(0,l.I3)(e)}}async function p(e,{params:t}){try{let{userId:s,role:r}=(0,l.v0)();if(!s)return(0,l.Hs)();if("admin"!==r)return(0,l.ID)();let{name:n,description:o}=await e.json(),i=await u.Z.schoolClub.update({where:{id:t.id},data:{name:n,description:o}});return a.NextResponse.json(i)}catch(e){return(0,l.I3)(e)}}async function m(e,{params:t}){try{let{userId:e,role:s}=(0,l.v0)();if(!e)return(0,l.Hs)();if("admin"!==s)return(0,l.ID)();return await u.Z.schoolClub.delete({where:{id:t.id}}),a.NextResponse.json({message:"Club deleted successfully"})}catch(e){return(0,l.I3)(e)}}let h=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/school-life/clubs/[id]/route",pathname:"/api/school-life/clubs/[id]",filename:"route",bundlePath:"app/api/school-life/clubs/[id]/route"},resolvedPagePath:"C:\\School Management System\\Working\\V2\\src\\app\\api\\school-life\\clubs\\[id]\\route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:f,staticGenerationAsyncStorage:x,serverHooks:g}=h,y="/api/school-life/clubs/[id]/route";function v(){return(0,i.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:x})}},49303:(e,t,s)=>{e.exports=s(30517)},5710:(e,t,s)=>{s.d(t,{Hs:()=>i,I3:()=>l,ID:()=>a,v0:()=>o,yw:()=>u});var r=s(26501),n=s(87070);function o(){let{userId:e,sessionClaims:t}=(0,r.d)();return{userId:e,role:t?.metadata?.role}}function i(){return n.NextResponse.json({message:"Unauthorized"},{status:401})}function a(){return n.NextResponse.json({message:"Forbidden"},{status:403})}function u(e){return n.NextResponse.json({message:e},{status:400})}function l(e){return console.error(e),n.NextResponse.json({message:"Internal Server Error"},{status:500})}},26501:(e,t,s)=>{s.d(t,{d:()=>n});var r=s(78459);function n(){try{let{userId:e,sessionClaims:t}=(0,r.I)();return{userId:e,sessionClaims:t,isBuildPhase:!1}}catch(e){if(e instanceof Error&&(e.message.includes("DYNAMIC_SERVER_USAGE")||e.message.includes("Dynamic server usage")||e.message.includes("headers")))return console.warn("[DeploymentGuard] Build-phase detected — auth() skipped."),{userId:null,sessionClaims:null,isBuildPhase:!0};throw e}}},13538:(e,t,s)=>{s.d(t,{Z:()=>n});var r=s(53524);let n=globalThis.prisma??new r.PrismaClient({log:["error"],datasources:{db:{url:process.env.DATABASE_URL}}})}};var t=require("../../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[8948,7070,8459],()=>s(4328));module.exports=r})();