aboutsummaryrefslogtreecommitdiff
path: root/web/models
diff options
context:
space:
mode:
authorKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-23 03:58:44 +0000
committerKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-23 03:58:44 +0000
commitf269caf1eb36c43269d92c89b7f0b0bafb88d572 (patch)
treea8a37b333e84e39365a57e36acaf64f4dbcdc8e3 /web/models
parent9d6e8a3c0dcbd7854eb35b5aad1d9b6fb58b6056 (diff)
switched tabs to 2 spaces
Diffstat (limited to 'web/models')
-rw-r--r--web/models/mockpoints.js34
-rw-r--r--web/models/points.js58
2 files changed, 46 insertions, 46 deletions
diff --git a/web/models/mockpoints.js b/web/models/mockpoints.js
index 51bd422..05e9f18 100644
--- a/web/models/mockpoints.js
+++ b/web/models/mockpoints.js
@@ -3,15 +3,15 @@ var mongoose = require('mongoose');
// Mongoose Schema definition
var Schema = mongoose.Schema;
var dumbJsonSchema = new Schema({
- type: String,
- coordinates: Array,
- gender: String,
- age: String,
- race: String,
- longhair: Boolean,
- longbeard: Boolean,
- extra: String,
- status: String
+ type: String,
+ coordinates: Array,
+ gender: String,
+ age: String,
+ race: String,
+ longhair: Boolean,
+ longbeard: Boolean,
+ extra: String,
+ status: String
});
// Mongoose Model definition
@@ -20,16 +20,16 @@ var dumbJson = mongoose.model('dumbJstring', dumbJsonSchema, 'dumbpointscollecti
// 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);
- });
+ 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);
- });
+ dumbJson.create(data, function(err, result) {
+ if (err) callback(err, null);
+ callback(null, result);
+ });
}
diff --git a/web/models/points.js b/web/models/points.js
index e8c181e..d506900 100644
--- a/web/models/points.js
+++ b/web/models/points.js
@@ -3,15 +3,15 @@ var mongoose = require('mongoose');
// Mongoose Schema definition
var Schema = mongoose.Schema;
var JsonSchema = new Schema({
- type: String,
- coordinates: Array,
- gender: String,
- age: String,
- race: String,
- longhair: Boolean,
- longbeard: Boolean,
- extra: String,
- status: String
+ type: String,
+ coordinates: Array,
+ gender: String,
+ age: String,
+ race: String,
+ longhair: Boolean,
+ longbeard: Boolean,
+ extra: String,
+ status: String
});
// Mongoose Model definition
@@ -20,34 +20,34 @@ 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);
- });
+ Json.find({}).exec(function(err, docs) {
+ if (err) callback(err, null);
+ callback(null, docs);
+ });
}
exports.get_all_active_points = function(callback) {
- var activeStatusTypes = ["new", "pending"];
- Json.find({ status: { $in: activeStatusTypes } }).exec(function(err, docs) {
- if (err) callback(err, null);
- callback(null, docs);
- });
+ var activeStatusTypes = ["new", "pending"];
+ Json.find({ status: { $in: activeStatusTypes } }).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);
- });
+ Json.create(data, function(err, result) {
+ if (err) callback(err, null);
+ callback(null, result);
+ });
}
exports.update_point_status = function(id, newStatus, callback) {
- Json.findByIdAndUpdate(id, {status: newStatus}, {new: true},
- function(err, result) {
- if (err) callback(err, null);
- // result contains the updated point document
- callback(null, result);
- }
- );
+ Json.findByIdAndUpdate(id, {status: newStatus}, {new: true},
+ function(err, result) {
+ if (err) callback(err, null);
+ // result contains the updated point document
+ callback(null, result);
+ }
+ );
}