fix linting errors

This commit is contained in:
Cassie Tarakajian 2017-01-24 17:20:40 -05:00
parent 257b44ad23
commit 0c6246fe45

View file

@ -7,7 +7,7 @@ import moment from 'moment';
export function createProject(req, res) { export function createProject(req, res) {
if (!req.user) { if (!req.user) {
return res.status(403).send({ success: false, message: 'Session does not match owner of project.'}); return res.status(403).send({ success: false, message: 'Session does not match owner of project.' });
} }
let projectValues = { let projectValues = {
@ -33,7 +33,7 @@ export function updateProject(req, res) {
return res.status(403).send({ success: false, message: 'Session does not match owner of project.' }); return res.status(403).send({ success: false, message: 'Session does not match owner of project.' });
} }
if (req.body.updatedAt && moment(req.body.updatedAt) < moment(project.updatedAt)) { if (req.body.updatedAt && moment(req.body.updatedAt) < moment(project.updatedAt)) {
return res.status(409).send({ success: false, message: 'Attempted to save stale version of project.' }) return res.status(409).send({ success: false, message: 'Attempted to save stale version of project.' });
} }
Project.findByIdAndUpdate(req.params.project_id, Project.findByIdAndUpdate(req.params.project_id,
{ {
@ -79,7 +79,7 @@ export function getProject(req, res) {
export function deleteProject(req, res) { export function deleteProject(req, res) {
Project.findById(req.params.project_id, (err, project) => { Project.findById(req.params.project_id, (err, project) => {
if (!req.user || !project.user.equals(req.user._id)) { if (!req.user || !project.user.equals(req.user._id)) {
return res.status(403).json({ success: false, message: 'Session does not match owner of project.'}); return res.status(403).json({ success: false, message: 'Session does not match owner of project.' });
} }
Project.remove({ _id: req.params.project_id }, (err) => { Project.remove({ _id: req.params.project_id }, (err) => {
if (err) { if (err) {
@ -109,13 +109,11 @@ export function getProjectsForUser(req, res) {
User.findOne({ username: req.params.username }, (err, user) => { User.findOne({ username: req.params.username }, (err, user) => {
if (!user) { if (!user) {
return res.status(404).json({ message: 'User with that username does not exist.' }); return res.status(404).json({ message: 'User with that username does not exist.' });
} else {
Project.find({ user: user._id }) // eslint-disable-line no-underscore-dangle
.sort('-createdAt')
.select('name files id createdAt updatedAt')
.exec((err, projects) => res.json(projects));
} }
return null; Project.find({ user: user._id }) // eslint-disable-line no-underscore-dangle
.sort('-createdAt')
.select('name files id createdAt updatedAt')
.exec((err, projects) => res.json(projects));
}); });
} else { } else {
// could just move this to client side // could just move this to client side
@ -132,7 +130,7 @@ function buildZip(project, req, res) {
const projectName = project.name; const projectName = project.name;
let numCompletedFiles = 0; let numCompletedFiles = 0;
zip.on('error', function (err) { zip.on('error', (err) => {
res.status(500).send({ error: err.message }); res.status(500).send({ error: err.message });
}); });