mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 14:43:00 +00:00
18 lines
418 B
JavaScript
18 lines
418 B
JavaScript
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({userID: this._id})
|
|
//.sort('created_at', 1)
|
|
.limit(5)
|
|
.exec(callback);
|
|
};
|
|
|
|
module.exports = UserSchema; |