Skip to content

Commit 48bd747

Browse files
author
Vikas Agarwal
committed
Lint fix
1 parent cfb206b commit 48bd747

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/routes/projects/create.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function createProjectAndPhases(req, project, projectTemplate, productTemplates)
100100
return models.ProjectEstimation.bulkCreate(estimations).then((projectEstimations) => {
101101
result.estimations = _.map(projectEstimations, estimation =>
102102
_.omit(estimation.toJSON(), ['deletedAt', 'deletedBy']));
103-
Promise.resolve(newProject)
103+
return Promise.resolve(newProject);
104104
});
105105
}
106106
return Promise.resolve(newProject);
@@ -261,6 +261,7 @@ module.exports = [
261261
}
262262
let newProject = null;
263263
let newPhases;
264+
let projectEstimations;
264265
models.sequelize.transaction(() => {
265266
req.log.debug('Create Project - Starting transaction');
266267
// Validate the templates
@@ -319,7 +320,9 @@ module.exports = [
319320
// set phases array
320321
newProject.phases = newPhases;
321322
// sets estimations array
322-
newProject.estimations = projectEstimations;
323+
if (projectEstimations) {
324+
newProject.estimations = projectEstimations;
325+
}
323326

324327
req.log.debug('Sending event to RabbitMQ bus for project %d', newProject.id);
325328
req.app.services.pubsub.publish(EVENT.ROUTING_KEY.PROJECT_DRAFT_CREATED,

0 commit comments

Comments
 (0)