From 21b203b9a6890d7a574bcc79ce41ade42a1ed94e Mon Sep 17 00:00:00 2001 From: Haripriya Date: Fri, 22 Aug 2025 15:48:58 +0530 Subject: [PATCH 1/2] recrutiment25 --- utils/models/recruitment.model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/models/recruitment.model.js b/utils/models/recruitment.model.js index 3cfa528..61b6d40 100644 --- a/utils/models/recruitment.model.js +++ b/utils/models/recruitment.model.js @@ -56,6 +56,6 @@ const participantSchema = new mongoose.Schema({ } }); -const ParticipantUser = mongoose.models.Recruitment24 || mongoose.model("Recruitment24", participantSchema); +const ParticipantUser = mongoose.models.Recruitment25 || mongoose.model("Recruitment25", participantSchema); module.exports = ParticipantUser; From 15200e453163dbe47c9b753a52e908a19a1b97e0 Mon Sep 17 00:00:00 2001 From: Haripriya Date: Fri, 22 Aug 2025 22:39:00 +0530 Subject: [PATCH 2/2] recruitment separate db --- pages/api/v1/recruitment/index.js | 4 ++-- utils/db/index.js | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pages/api/v1/recruitment/index.js b/pages/api/v1/recruitment/index.js index 5f1cb27..de59f70 100644 --- a/pages/api/v1/recruitment/index.js +++ b/pages/api/v1/recruitment/index.js @@ -1,7 +1,7 @@ -import DBInstance from "@/utils/db"; +import RecruitmentDBInstance from "@/utils/db"; import Participant from "@/utils/models/recruitment.model.js"; -DBInstance(); +RecruitmentDBInstance(); export default async function handler(req, res) { if (req.method === "POST") { diff --git a/utils/db/index.js b/utils/db/index.js index 6054ca9..fdc0cb2 100644 --- a/utils/db/index.js +++ b/utils/db/index.js @@ -3,7 +3,7 @@ import dotenv from "dotenv"; dotenv.config(); -const { MONGO_URI, DB_NAME } = process.env; +const { MONGO_URI, DB_NAME , RECRUITMENT_MONGO_URI , RECRUITMENT_DB_NAME } = process.env; const DBInstance = async () => { try { @@ -20,4 +20,20 @@ const DBInstance = async () => { } }; +const RecruitmentDBInstance = async () => { + try { + await mongoose.connect(RECRUITMENT_MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + dbName: RECRUITMENT_DB_NAME + }); + + // console.log(`✅ Connected to MongoDB: ${NEXT_PUBLIC_DB_NAME}`); + } catch (err) { + // console.error("❌ Could not connect to MongoDB\n", err.message); + throw err; + } +}; + export default DBInstance; +export {RecruitmentDBInstance}