diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-13 11:30:02 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-13 11:30:02 +0200 |
commit | fc86b5e1f929f27b1cb552c9cdb123e793318548 (patch) | |
tree | 41ba3f10e4ee3f98d40bc7f1e70c086c7b75f870 | |
parent | made the postProject-thingy LOOK PRETTY! (diff) | |
download | Divid-fc86b5e1f929f27b1cb552c9cdb123e793318548.tar.gz |
added user stats
-rw-r--r-- | models/User.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/models/User.js b/models/User.js index 4d32941..9e6e52f 100644 --- a/models/User.js +++ b/models/User.js @@ -11,6 +11,12 @@ var mongoose = require('mongoose') /** * User schema + * + * statuscodes: + * 1: invited + * 2: unconfirmed + * 3: active + * 4: paying user */ var UserSchema = new Schema({ @@ -22,9 +28,11 @@ var UserSchema = new Schema({ salt: String, accessToken: String, facebook: {}, - twitter: {} + twitter: {}, + status: { type: Number, default: 2 } }); + /** * Virtuals */ @@ -37,9 +45,11 @@ UserSchema this.hashed_password = this.encryptPassword(password) }).get(function() { return this._password }); + /** * Validations */ + var validatePrecenceOf = function (value) { return value && value.length; } @@ -67,6 +77,7 @@ UserSchema.path('hashed_password').validate(function(hashed_password) { return hashed_password.length; }, 'Password cannot be blank'); + /** * Pre-save hook */ |