mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-25 23:25:51 +00:00
improve improvement category validation
This commit is contained in:
parent
668ad6ff45
commit
a1e1ac211f
1 changed files with 6 additions and 8 deletions
|
|
@ -391,14 +391,12 @@ var UserSchema = new Schema({
|
|||
raisePet: {type: Boolean, 'default': false},
|
||||
streak: {type: Boolean, 'default': false}
|
||||
},
|
||||
improvementCategories: {type: Array, validate: function (categories) {
|
||||
var validValues = true;
|
||||
categories.forEach(function (cat) {
|
||||
if (['work', 'exercise', 'healthWellness', 'school', 'teams', 'chores', 'creativity'].indexOf(cat) === -1){
|
||||
validValues = false;
|
||||
}
|
||||
});
|
||||
return validValues;
|
||||
improvementCategories: {
|
||||
type: Array,
|
||||
validate: (categories) => {
|
||||
const validCategories = ['work', 'exercise', 'healthWellness', 'school', 'teams', 'chores', 'creativity'];
|
||||
let isValidCategory = categories.every(category => validValues.indexOf(category) !== -1);
|
||||
return isValidCategory;
|
||||
}}
|
||||
},
|
||||
profile: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue