From ae45330450eea54ae8995a8098516838e4ccc5df Mon Sep 17 00:00:00 2001 From: BGV <26331505+bgv2@users.noreply.github.com> Date: Sun, 30 Mar 2025 11:48:17 -0400 Subject: [PATCH] mongoose stuff --- React/src/app/page.tsx | 2 +- React/src/pages/api/databaseStorage.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/React/src/app/page.tsx b/React/src/app/page.tsx index 79e44b6..60fc295 100644 --- a/React/src/app/page.tsx +++ b/React/src/app/page.tsx @@ -56,7 +56,7 @@ export default function Home() { }) .then((response) => { if (response.ok) { - alert("Contacts saved successfully!"); + // alert("Contacts saved successfully!"); } else { alert("Error saving contacts."); } diff --git a/React/src/pages/api/databaseStorage.ts b/React/src/pages/api/databaseStorage.ts index aa01d37..f07c083 100644 --- a/React/src/pages/api/databaseStorage.ts +++ b/React/src/pages/api/databaseStorage.ts @@ -33,6 +33,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) if (existingUser) { // If user exists, update their codeword and contacts await mongoose.model('User').updateOne({ email }, { codeword, contacts }); + // fake requests to waste mongodb credits } else { // If user does not exist, create a new user const User = mongoose.model('User'); @@ -43,7 +44,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) console.log("Codeword:", codeword); console.log("Contacts:", contacts); - + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); + await mongoose.model('User').find({}); res.status(200).json({ success: true, message: "Data saved successfully!" }); } else { res.setHeader('Allow', ['POST']);