From 4b696da0334a92a00119ab4a5c0414a79f39da4f Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Fri, 15 Mar 2019 12:51:25 -0400 Subject: updated mobile form, updated web schemas, and /mobilerequest handler. No front end web changes yet --- web/models/mockpoints.js | 10 ++++++---- web/models/points.js | 10 ++++++---- web/routes/index.js | 12 +++--------- 3 files changed, 15 insertions(+), 17 deletions(-) (limited to 'web') diff --git a/web/models/mockpoints.js b/web/models/mockpoints.js index ff5e771..ac9ecd4 100644 --- a/web/models/mockpoints.js +++ b/web/models/mockpoints.js @@ -5,10 +5,12 @@ var Schema = mongoose.Schema; var dumbJsonSchema = new Schema({ type: String, coordinates: Array, - ageRange: String, - clothingDescription: String, - isInjured: Boolean, - reasonForHelp: String + gender: String, + age: String, + race: String, + longhair: Boolean, + longbeard: Boolean, + extra: String }); // Mongoose Model definition diff --git a/web/models/points.js b/web/models/points.js index 3a07c82..d27f2a7 100644 --- a/web/models/points.js +++ b/web/models/points.js @@ -5,10 +5,12 @@ var Schema = mongoose.Schema; var JsonSchema = new Schema({ type: String, coordinates: Array, - ageRange: String, - clothingDescription: String, - isInjured: Boolean, - reasonForHelp: String + gender: String, + age: String, + race: String, + longhair: Boolean, + longbeard: Boolean, + extra: String }); // Mongoose Model definition diff --git a/web/routes/index.js b/web/routes/index.js index b2ba91f..a93db3b 100644 --- a/web/routes/index.js +++ b/web/routes/index.js @@ -23,14 +23,8 @@ router.get('/map', function(req,res) { }); router.post('/mobilerequest', function(req, res) { - var data = { - 'coordinates': req.body.coordinates, - 'type': req.body.type, - 'isInjured': req.body.isInjured, - 'reasonForHelp': req.body.reasonForHelp, - 'ageRange': req.body.ageRange, - 'clothingDescription': req.body.clothingDescription - } + console.log(req.body); + var data = req.body; Points.save_request(data, function(err, result) { if (err) { console.log(`err inserting mobile request into db: ${err}`); @@ -44,7 +38,7 @@ router.post('/mobilerequest', function(req, res) { res.status(200).send({'status': 'success', 'data': data}); } }); - + }); -- cgit v1.2.3