aboutsummaryrefslogtreecommitdiff
path: root/web/models/points.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/models/points.js')
-rw-r--r--web/models/points.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/web/models/points.js b/web/models/points.js
index 18ffe2e..3a07c82 100644
--- a/web/models/points.js
+++ b/web/models/points.js
@@ -4,8 +4,29 @@ var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var JsonSchema = new Schema({
type: String,
- coordinates: Array
+ coordinates: Array,
+ ageRange: String,
+ clothingDescription: String,
+ isInjured: Boolean,
+ reasonForHelp: String
});
// Mongoose Model definition
var Json = mongoose.model('Jstring', JsonSchema, 'pointscollection');
+
+// this function gets ALL the points from the db
+// returns the entire document without modifications
+exports.get_points = function(callback) {
+ Json.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) {
+ Json.create(data, function(err, result) {
+ if (err) callback(err, null);
+ callback(null, result);
+ });
+}