-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78ce83d
commit 1eac2d5
Showing
1 changed file
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); |