diff options
| author | Kumar Damani <kumar.damani@mail.utoronto.ca> | 2019-02-28 17:49:21 +0000 |
|---|---|---|
| committer | Kumar Damani <kumar.damani@mail.utoronto.ca> | 2019-02-28 17:49:21 +0000 |
| commit | 5dd172866ff87842db07e563b3cb77cc3c2577a8 (patch) | |
| tree | e4691429ed02491fba13de2a1e5b5102b19ccd77 /web/models/mockpoints.js | |
| parent | 76214c83dc52d4dca6e5043fe374da57a54f9738 (diff) | |
| parent | 9764fba35cdac7e226dad65f061c09fd3d9909cc (diff) | |
merged feat7 into temp
Diffstat (limited to 'web/models/mockpoints.js')
| -rw-r--r-- | web/models/mockpoints.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/web/models/mockpoints.js b/web/models/mockpoints.js new file mode 100644 index 0000000..ff5e771 --- /dev/null +++ b/web/models/mockpoints.js @@ -0,0 +1,32 @@ +var mongoose = require('mongoose'); + +// Mongoose Schema definition +var Schema = mongoose.Schema; +var dumbJsonSchema = new Schema({ + type: String, + coordinates: Array, + ageRange: String, + clothingDescription: String, + isInjured: Boolean, + reasonForHelp: String +}); + +// Mongoose Model definition +var dumbJson = mongoose.model('dumbJstring', dumbJsonSchema, 'dumbpointscollection'); + +// this function gets ALL the points from the db +// returns the entire document without modifications +exports.get_points = function(callback) { + dumbJson.find({}).exec(function(err, docs) { + if (err) callback(err, null); + callback(null, docs); + }); +} + +// this function stores A user report into the db +exports.save_request = function(data, callback) { + dumbJson.create(data, function(err, result) { + if (err) callback(err, null); + callback(null, result); + }); +} |
