Skip to content

Commit

Permalink
just modified my original schema to have additional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
SSBinks committed Jan 19, 2017
1 parent 70be74f commit 6d30301
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
4 changes: 3 additions & 1 deletion models/assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ var AssignmentSchema = new Schema ({
dueDate: {type: Date, min: moment().subtract(1, 'day'), max: moment().add(2, 'years').calendar()},
progress: {type: Number, min: 0, max: 100},
complete: Boolean,
category: String
category: String,
part: String,
completionAmount: Number
});

module.exports = mongoose.model('Assignment', AssignmentSchema);
19 changes: 1 addition & 18 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,7 @@ AssignmentType.find({category: req.params.category}, function(err, type){
res.json(type);
});
})
router.route('/assign/category')
.post( function(req, res){
var type = new AssignmentType();
console.log('>>>>This is type object ' + JSON.stringify(type))
type.category = req.body.category;
type.fieldOne.name = req.body.fname;
type.fieldOne.length = req.body.fnum;
type.fieldTwo.name = req.body.sname;
type.fieldTwo.length = req.body.snum;
type.fieldThree.name = req.body.tname;
type.fieldThree.length = req.body.tnum;
console.log('This is the body ' + JSON.stringify(req.body));
type.save(function(err){
if(err)
res.send('Yall dont want zero problems' + err);
// res.json({ message: "It worked?"});
});
});

app.use('/', router)
app.listen(port);
console.log('Got it up going high when they go low');

0 comments on commit 6d30301

Please sign in to comment.