[#1726] remove updateTasks() batch api route. That's not how we're using

batch (we'll create a proper batch route & document later), and we
shouldn't support this route
This commit is contained in:
Tyler Renelle 2013-11-08 14:01:29 -08:00
parent 5f9d3991ac
commit f35df8a47f
2 changed files with 0 additions and 30 deletions

View file

@ -174,35 +174,6 @@ api.updateTask = function(req, res, next) {
});
};
/**
* Update tasks (plural). This will update, add new, delete, etc all at once.
* TODO Should we keep this?
*/
api.updateTasks = function(req, res, next) {
var user = res.locals.user;
var tasks = req.body;
_.each(tasks, function(task, idx) {
if (task.id) {
// delete
if (task.del) {
user.deleteTask(task.id);
task = {deleted: true};
} else {
// Update
// updateTask(user, task.id, task); //FIXME
}
} else {
// Create
task = addTask(user, task);
}
tasks[idx] = task;
});
user.save(function(err, saved) {
if (err) return res.json(500, {err: err});
return res.json(201, tasks);
});
};
api.createTask = function(req, res, next) {
var user = res.locals.user;
var task = addTask(user, req.body);

View file

@ -32,7 +32,6 @@ router.post('/user/tasks/:id/:direction', auth.auth, cron, user.scoreTask);
router.get('/user/tasks', auth.auth, cron, user.getTasks);
router.get('/user/task/:id', auth.auth, cron, user.getTask);
router.put('/user/task/:id', auth.auth, cron, verifyTaskExists, user.updateTask);
router.post('/user/tasks', auth.auth, cron, user.updateTasks);
router["delete"]('/user/task/:id', auth.auth, cron, verifyTaskExists, user.deleteTask);
router.post('/user/task', auth.auth, cron, user.createTask);
router.put('/user/task/:id/sort', auth.auth, cron, verifyTaskExists, user.sortTask);