migrating repo to Bodyrep org

This commit is contained in:
2013-01-19 11:23:43 -05:00
parent 31b7303f43
commit 4ea082330b
891 changed files with 142706 additions and 0 deletions

18
data/schemas/user.js Normal file
View File

@@ -0,0 +1,18 @@
var mongoose = require('mongoose');
var UserSchema = new mongoose.Schema({
username: {type: String, unique: true, required: true},
name: String,
password: String,
is_admin: {type: Boolean, 'default': false }
});
UserSchema.methods.recentworkouts = function(callback) {
return this.model('workout')
.find({author: this._id})
//.sort('created_at', 1)
.limit(5)
.exec(callback);
};
module.exports = UserSchema;