diff --git a/controllers/projectController.js b/controllers/projectController.js index 8b064b0..ed57844 100644 --- a/controllers/projectController.js +++ b/controllers/projectController.js @@ -88,7 +88,49 @@ exports.addUserToProject = function(req, res) { }); }); }; +exports.userStartWorking = function(req, res) { + console.log("userStartWorking"); + projectModel.findById(req.params.id, function(err, project) { + var workstrike={ + username: req.body.username, + start: new Date(), + end: "", + }; + project.workStrikes.push(workstrike); + console.log(project); + project.save(function(err) { + if(err) return res.send(500, err.message); + + projectModel.find(function(err, projects) { + if(err) res.send(500, err.message); + res.status(200).jsonp(projects); + }); + }); + }); +}; +exports.userStopWorking = function(req, res) { + console.log("userStopWorking"); + projectModel.findById(req.params.id, function(err, project) { + for(var i=0; i