mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 06:32:11 +00:00
added methods and routes for getting an exercises history, and the sum of a workouts musclearrays -- incl a modifier
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
var mongoose = require('mongoose');
|
||||
var Schema = require('mongoose').Schema;
|
||||
|
||||
|
||||
var ExerciseStat = new Schema({
|
||||
exerciseID: { type: Schema.ObjectId, ref: 'Exercise'},
|
||||
modifier: {type: Number}
|
||||
});
|
||||
|
||||
|
||||
var UserSchema = new mongoose.Schema({
|
||||
username: {type: String, unique: true, required: true},
|
||||
name: String,
|
||||
password: String,
|
||||
is_admin: {type: Boolean, 'default': false },
|
||||
is_imperial: {type: Boolean, 'default': false },
|
||||
favorites: [{ type: Schema.ObjectId, ref: 'Exercises'}]
|
||||
favorites: [{ type: Schema.ObjectId, ref: 'Exercises'}],
|
||||
exercisestats: [ExerciseStat]
|
||||
});
|
||||
|
||||
UserSchema.methods.recentworkouts = function(callback) {
|
||||
|
||||
@@ -8,7 +8,8 @@ var Split = new Schema({
|
||||
|
||||
|
||||
var Element = new Schema({
|
||||
exerciseID: String,
|
||||
exerciseID: { type: Schema.ObjectId, ref: 'Exercise'},
|
||||
modifier: {type: Number},
|
||||
splits: [Split]
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user