@@ -97,7 +97,11 @@ function createProjectAndPhases(req, project, projectTemplate, productTemplates)
9797 createdBy : req . authUser . userId ,
9898 updatedBy : req . authUser . userId ,
9999 } , estimation ) ) ;
100- return models . ProjectEstimation . bulkCreate ( estimations ) . then ( ( ) => Promise . resolve ( newProject ) ) ;
100+ return models . ProjectEstimation . bulkCreate ( estimations ) . then ( ( projectEstimations ) => {
101+ result . estimations = _ . map ( projectEstimations , estimation =>
102+ _ . omit ( estimation . toJSON ( ) , [ 'deletedAt' , 'deletedBy' ] ) ) ;
103+ Promise . resolve ( newProject )
104+ } ) ;
101105 }
102106 return Promise . resolve ( newProject ) ;
103107 } ) . then ( ( newProject ) => {
@@ -269,6 +273,7 @@ module.exports = [
269273 . then ( ( createdProjectAndPhases ) => {
270274 newProject = createdProjectAndPhases . newProject ;
271275 newPhases = createdProjectAndPhases . newPhases ;
276+ projectEstimations = createProjectAndPhases . estimations ;
272277
273278 req . log . debug ( 'new project created (id# %d, name: %s)' , newProject . id , newProject . name ) ;
274279 // create direct project with name and description
@@ -313,6 +318,8 @@ module.exports = [
313318 newProject . attachments = [ ] ;
314319 // set phases array
315320 newProject . phases = newPhases ;
321+ // sets estimations array
322+ newProject . estimations = projectEstimations ;
316323
317324 req . log . debug ( 'Sending event to RabbitMQ bus for project %d' , newProject . id ) ;
318325 req . app . services . pubsub . publish ( EVENT . ROUTING_KEY . PROJECT_DRAFT_CREATED ,
0 commit comments