Skip to content

Commit

Permalink
Roommate testing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGElCOgecko committed Apr 10, 2024
1 parent 78ce83d commit 1eac2d5
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion backend/services/roommate.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,59 @@ exports.getAllRoommateFormsService = async (params, body) => {
/*********************************
************ TESTING ************
*********************************/
/* RECOPIED FUNCTIONS */
addRoommateFormService = async (params, body) => {
try {
// Check if user has already submitted a form
// const user = await mdb.roomies.findOne({ email: body.vanderbiltEmail });
// if (user) {
// console.log("addRoommateFormService Error: User already submitted a roommate form");
// return { status: "ERROR", data: "User already submitted a roommate form" };
// }

// Insert roommate form into MongoDB
const result = await mdb.roomies.insertOne({
...body,
});

console.log("addRoommateFormService Success:", result);
return { status: "OK", data: body };
} catch (error) {
console.log("addRoommateFormService Error:", error);
return { status: "ERROR", data: error.message };
}
};
getAllRoommateFormsService = async (params, body) => {
try {
const forms = await mdb.roomies.find({}).toArray();
console.log("getAllRoommateForms Success:", forms);
return { status: "OK", data: forms };
} catch (error) {
console.log("getAllRoommateForms Error:", error);
return { status: "ERROR", data: error };
}
};

/* TESTING */
setTimeout(function() { // third set of tests to run (user, org, roommate)
console.log("I am roommate testing, I am running");

let roomForm = {
'fullName': "Nnaammee",
'vanderbiltEmail': "[email protected]",
'vunetId': "nameME",
'pets': "Yes",
'sleepSchedulePreferences': 'earlyBird',
'cleanliness': "20",
'overnightGuestsFrequency': "10",
'studyNoisePreference': '100',
'studyLocationPreference': "100",
'friendsOverFrequency': "80",
'smoke': "No",
'comfortableWithSmokers': "No",
'alcoholComfortLevel': '90',
'conflictResolution': "Need time to cool off",
'locationPreference': "McTyeire"
}
let room = addRoommateFormService({}, roomForm); console.log("Add roommate form: ", room);
//console.log("ALL roommates: ", getAllRoommateFormsService());
}, 15000);

0 comments on commit 1eac2d5

Please sign in to comment.