"use strict";(()=>{var e={};e.id=439,e.ids=[439],e.modules={3524:e=>{e.exports=require("@prisma/client")},7096:e=>{e.exports=require("bcrypt")},9344:e=>{e.exports=require("jsonwebtoken")},145:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},8855:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>c,routeModule:()=>l});var s={};t.r(s),t.d(s,{default:()=>d});var a=t(1802),o=t(7153),i=t(6249),n=t(8103),u=t(432);async function d(e,r){if("POST"!==e.method)return r.status(405).json({success:!1,error:"Method not allowed"});if(!await (0,n.m)(e,r))return;let{id:t}=e.query,{content:s}=e.body;if("string"!=typeof t)return r.status(400).json({success:!1,error:"Invalid material ID"});if(!s||!s.trim())return r.status(400).json({success:!1,error:"Comment content is required"});try{let a=await u.U.addComment(t,e.user.id,s);return r.status(201).json({success:!0,data:a})}catch(e){return console.error("Error adding comment:",e),r.status(500).json({success:!1,error:"Failed to add comment"})}}let c=(0,i.l)(s,"default"),m=(0,i.l)(s,"config"),l=new a.PagesAPIRouteModule({definition:{kind:o.x.PAGES_API,page:"/api/v1/materials/[id]/comments",pathname:"/api/v1/materials/[id]/comments",bundlePath:"",filename:""},userland:s})}};var r=require("../../../../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[876],()=>t(8855));module.exports=s})();