Extend profile model with gatherMusic

This commit is contained in:
Chris Blanchard 2015-09-18 12:53:01 +01:00
parent 6c3f56cb26
commit 2814eabf72
3 changed files with 7 additions and 4 deletions

View file

@ -15,7 +15,8 @@ var profileSchema = new Schema({
}, },
enslo: { type: Number, default: null }, enslo: { type: Number, default: null },
division: { type: String, default: null }, division: { type: String, default: null },
skill: { type: String, default: null } skill: { type: String, default: null },
gatherMusic: { type: String, default: null }
}); });
profileSchema.path('userId').index({ unique: true }); profileSchema.path('userId').index({ unique: true });

View file

@ -53,7 +53,7 @@ User.prototype.getHiveId = () => {
return index === 1 ? (tailId * 2) + 1 : tailId * 2; return index === 1 ? (tailId * 2) + 1 : tailId * 2;
}; };
var allowedAttributes = ["enslo", "division", "skill"]; var allowedAttributes = ["enslo", "division", "skill", "gatherMusic"];
var allowedAbilities = ["skulk", "lerk", "fade", "gorge", "onos", "commander"]; var allowedAbilities = ["skulk", "lerk", "fade", "gorge", "onos", "commander"];
User.prototype.updateProfile = (data, callback) => { User.prototype.updateProfile = (data, callback) => {
let self = this; let self = this;

View file

@ -68,13 +68,15 @@ describe("User", () => {
var attrs = { var attrs = {
enslo: 88, enslo: 88,
division: "Foo", division: "Foo",
skill: "Bar" skill: "Bar",
gatherMusic: "Baz"
}; };
user.updateProfile(attrs, (error, profile) => { user.updateProfile(attrs, (error, profile) => {
if (error) return done(error); if (error) return done(error);
assert.equal(profile.enslo, attrs.enslo); assert.equal(profile.enslo, attrs.enslo);
assert.equal(profile.division, attrs.division); assert.equal(profile.division, attrs.division);
assert.equal(profile.foo, attrs.foo); assert.equal(profile.skill, attrs.skill);
assert.equal(profile.gatherMusic, attrs.gatherMusic);
done(); done();
}); });
}); });