From fc86b5e1f929f27b1cb552c9cdb123e793318548 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Mon, 13 May 2013 11:30:02 +0200 Subject: added user stats --- models/User.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3