"use strict";(()=>{var e={};e.id=225,e.ids=[225],e.modules={11185:e=>{e.exports=require("mongoose")},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")},51699:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>g,patchFetch:()=>f,requestAsyncStorage:()=>m,routeModule:()=>d,serverHooks:()=>h,staticGenerationAsyncStorage:()=>y});var n={};t.r(n),t.d(n,{GET:()=>l,POST:()=>p});var o=t(49303),s=t(88716),a=t(60670),i=t(87070),u=t(14184),c=t(29045);async function l(){try{await (0,u.Z)();let e=await c.Z.find().sort({dayOfWeek:1,startTime:1});return i.NextResponse.json(e)}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to process request"},{status:500})}}async function p(e){try{await (0,u.Z)();let r=await e.json();if(Array.isArray(r)){await c.Z.deleteMany({});let e=await c.Z.insertMany(r);return i.NextResponse.json(e)}{let e=new c.Z(r);return await e.save(),i.NextResponse.json(e)}}catch(e){return i.NextResponse.json({error:e instanceof Error?e.message:"Failed to process request"},{status:500})}}let d=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/schedule/route",pathname:"/api/schedule",filename:"route",bundlePath:"app/api/schedule/route"},resolvedPagePath:"E:\\WEB Project\\My Plan\\src\\app\\api\\schedule\\route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:m,staticGenerationAsyncStorage:y,serverHooks:h}=d,g="/api/schedule/route";function f(){return(0,a.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:y})}},14184:(e,r,t)=>{t.d(r,{Z:()=>i});var n=t(11185),o=t.n(n);let s=process.env.MONGODB_URI;if(!s)throw Error("Please define the MONGODB_URI environment variable inside .env.local");let a=global.mongoose;a||(a=global.mongoose={conn:null,promise:null});let i=async function(){if(a.conn)return a.conn;a.promise||(a.promise=o().connect(s,{bufferCommands:!1}));try{a.conn=await a.promise}catch(e){throw a.promise=null,e}return a.conn}},29045:(e,r,t)=>{t.d(r,{Z:()=>a});var n=t(11185),o=t.n(n);let s=new n.Schema({dayOfWeek:{type:String,required:!0},startTime:{type:String,required:!0},endTime:{type:String,required:!0},activityName:{type:String,required:!0},blockType:{type:String,required:!0},color:{type:String,required:!0}}),a=o().models.ScheduleBlock||o().model("ScheduleBlock",s)}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),n=r.X(0,[948,972],()=>t(51699));module.exports=n})();