Merge pull request #6733 from vIiRuS/mobileStorage

Store data for next mobile update
This commit is contained in:
Sabe Jones
2016-03-09 14:56:15 -06:00
5 changed files with 50 additions and 4 deletions
+9 -1
View File
@@ -355,7 +355,15 @@ api.update = (req, res, next) => {
user.save((err) => {
if (!_.isEmpty(errors)) return res.json(401, {err: errors});
if (err) return next(err);
if (err) {
if (err.name == 'ValidationError') {
let errorMessages = _.map(_.values(err.errors), (error) => {
return error.message;
});
return res.json(400, {err: errorMessages});
}
return next(err);
}
res.json(200, user);
user = errors = null;
+6 -1
View File
@@ -28,7 +28,12 @@ var TaskSchema = {
broken: String, // CHALLENGE_DELETED, TASK_DELETED, UNSUBSCRIBED, CHALLENGE_CLOSED
winner: String // user.profile.name
// group: {type: 'Strign', ref: 'Group'} // if we restore this, rename `id` above to `challenge`
}
},
reminders: [{
id: {type:String,'default':shared.uuid},
startDate: Date,
time: Date
}]
};
var HabitSchema = new Schema(
+8 -1
View File
@@ -390,7 +390,14 @@ var UserSchema = new Schema({
hatchPet: {type: Boolean, 'default': false},
raisePet: {type: Boolean, 'default': false},
streak: {type: Boolean, 'default': false}
}
},
improvementCategories: {
type: Array,
validate: (categories) => {
const validCategories = ['work', 'exercise', 'healthWellness', 'school', 'teams', 'chores', 'creativity'];
let isValidCategory = categories.every(category => validCategories.indexOf(category) !== -1);
return isValidCategory;
}}
},
profile: {
blurb: String,