"use strict";(()=>{var e={};e.id=869,e.ids=[869],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")},79661:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>f,patchFetch:()=>v,requestAsyncStorage:()=>m,routeModule:()=>p,serverHooks:()=>x,staticGenerationAsyncStorage:()=>h});var n={};r.r(n),r.d(n,{POST:()=>l,dynamic:()=>d});var s=r(49303),a=r(88716),o=r(60670),i=r(87070),u=r(13538),c=r(5710);let d="force-dynamic";async function l(e){try{let{userId:t,role:r}=(0,c.v0)();if(!t)return(0,c.Hs)();if("admin"!==r&&"teacher"!==r)return(0,c.ID)();let{eventId:n,targetUserId:s,targetUserRole:a}=await e.json();if(!n||!s||!a)return(0,c.yw)("eventId, targetUserId, and targetUserRole are required");if(await u.Z.schoolEventAttendance.findFirst({where:{eventId:n,userId:s}}))return(0,c.yw)("Attendance already marked for this user");let o=await u.Z.schoolEventAttendance.create({data:{eventId:n,userId:s,role:a}});return i.NextResponse.json(o,{status:201})}catch(e){return(0,c.I3)(e)}}let p=new s.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/school-life/events/attendance/route",pathname:"/api/school-life/events/attendance",filename:"route",bundlePath:"app/api/school-life/events/attendance/route"},resolvedPagePath:"C:\\School Management System\\Working\\V2\\src\\app\\api\\school-life\\events\\attendance\\route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:m,staticGenerationAsyncStorage:h,serverHooks:x}=p,f="/api/school-life/events/attendance/route";function v(){return(0,o.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:h})}},49303:(e,t,r)=>{e.exports=r(30517)},5710:(e,t,r)=>{r.d(t,{Hs:()=>o,I3:()=>c,ID:()=>i,v0:()=>a,yw:()=>u});var n=r(26501),s=r(87070);function a(){let{userId:e,sessionClaims:t}=(0,n.d)();return{userId:e,role:t?.metadata?.role}}function o(){return s.NextResponse.json({message:"Unauthorized"},{status:401})}function i(){return s.NextResponse.json({message:"Forbidden"},{status:403})}function u(e){return s.NextResponse.json({message:e},{status:400})}function c(e){return console.error(e),s.NextResponse.json({message:"Internal Server Error"},{status:500})}},26501:(e,t,r)=>{r.d(t,{d:()=>s});var n=r(78459);function s(){try{let{userId:e,sessionClaims:t}=(0,n.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,r)=>{r.d(t,{Z:()=>s});var n=r(53524);let s=globalThis.prisma??new n.PrismaClient({log:["error"],datasources:{db:{url:process.env.DATABASE_URL}}})}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,7070,8459],()=>r(79661));module.exports=n})();