Skip to content

Commit

Permalink
closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-Thakur committed Sep 8, 2021
1 parent 6ffe348 commit 6648a2c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions controllers/responseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ router.post('/addResponse', (req,res) => {
function addResponse(req,res) {
console.log(req.body);
var newResponse = new response();
newResponse.userIP = req.body.userIP;
newResponse.surveyId = req.body.surveyId;
newResponse.submittedOn = req.body.submittedOn;
newResponse.answer = req.body.answer;
Expand Down
3 changes: 3 additions & 0 deletions controllers/surveyController.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ router.post('/changeStatus', (req,res) => {
survey.findOne({ id : req.body.id }, function(err, docs) {
if(!err){
docs.active = req.body.active;
docs.modifiedOn = new Date();
docs.save(function(err) {
if(!err){
var response = {
Expand Down Expand Up @@ -54,6 +55,8 @@ router.post('/createSurvey', (req,res) => {

function addSurvey(req,res) {
var newSurvey = new survey();
newSurvey.surveyName = req.body.surveyName;
newSurvey.surveyDescription = req.body.surveyDescription;
newSurvey.createdBy = req.body.createdBy;
newSurvey.createdOn = req.body.createdOn;
newSurvey.validTill = req.body.validTill;
Expand Down
3 changes: 1 addition & 2 deletions controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ router.post('/login', (req, res) => {
});
function insertUser(req, res){
var newUser = new user();
newUser.signUpType = req.body.signUpType;
newUser.fullName = req.body.fullName;
newUser.email = req.body.email;
bcrypt.cryptPassword(req.body.password, (err, hash) => {
Expand All @@ -57,8 +58,6 @@ function insertUser(req, res){
}

function fetchUser(req, res) {
console.log('login');
console.log(req.body);
user.findOne( { email: req.body.email}, function(err, docs) {
if(!err){
bcrypt.comparePassword(req.body.password, docs.password, (err, cmp) => {
Expand Down

1 comment on commit 6648a2c

@vercel
Copy link

@vercel vercel bot commented on 6648a2c Sep 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.