From 761737ef7336af220eff343c74850b2dfb2d8b57 Mon Sep 17 00:00:00 2001 From: Johannes Qian Date: Sat, 2 Nov 2024 22:29:36 -0400 Subject: [PATCH] Do not need to add chapter actions --- src/actions/Chapter.ts | 8 -------- src/actions/dbConnect.ts | 19 ------------------- 2 files changed, 27 deletions(-) delete mode 100644 src/actions/Chapter.ts delete mode 100644 src/actions/dbConnect.ts diff --git a/src/actions/Chapter.ts b/src/actions/Chapter.ts deleted file mode 100644 index e7fe18bd..00000000 --- a/src/actions/Chapter.ts +++ /dev/null @@ -1,8 +0,0 @@ -import ChapterModel from "../models/Chapter"; -import dbConnect from "./dbConnect"; - -export async function getAllChapters() { - await dbConnect(); - console.log(ChapterModel.find()); - return ChapterModel.find(); -} diff --git a/src/actions/dbConnect.ts b/src/actions/dbConnect.ts deleted file mode 100644 index b130f003..00000000 --- a/src/actions/dbConnect.ts +++ /dev/null @@ -1,19 +0,0 @@ -import mongoose from "mongoose"; - -async function dbConnect(): Promise { - if (mongoose.connections[0].readyState) { - return; - } - - await mongoose - .connect(process.env.MONGODB_URL, { - socketTimeoutMS: 360000, - dbName: process.env.MONGODB_NAME, - }) - .catch((error) => { - console.error("Error connecting to database: ", error); - throw error; - }); -} - -export default dbConnect;