diff --git a/src/routes/projects/create.js b/src/routes/projects/create.js index 1b940c19..893035f4 100644 --- a/src/routes/projects/create.js +++ b/src/routes/projects/create.js @@ -409,7 +409,7 @@ module.exports = [ }); // override values _.assign(project, { - status: PROJECT_STATUS.DRAFT, + status: PROJECT_STATUS.IN_REVIEW, createdBy: req.authUser.userId, updatedBy: req.authUser.userId, lastActivityAt: new Date(), @@ -468,7 +468,7 @@ module.exports = [ // add to project history asynchronously, don't wait for it to complete models.ProjectHistory.create({ projectId: newProject.id, - status: PROJECT_STATUS.DRAFT, + status: PROJECT_STATUS.IN_REVIEW, cancelReason: null, updatedBy: req.authUser.userId, }).then(() => req.log.debug('project history created for project %d', newProject.id)) diff --git a/src/routes/projects/create.spec.js b/src/routes/projects/create.spec.js index 670041c9..0c5c9775 100644 --- a/src/routes/projects/create.spec.js +++ b/src/routes/projects/create.spec.js @@ -434,7 +434,7 @@ describe('Project create', () => { should.exist(resJson.billingAccountId); should.exist(resJson.name); resJson.directProjectId.should.be.eql(128); - resJson.status.should.be.eql('draft'); + resJson.status.should.be.eql('in_review'); resJson.type.should.be.eql(body.param.type); resJson.version.should.be.eql('v3'); resJson.members.should.have.lengthOf(1); @@ -490,7 +490,7 @@ describe('Project create', () => { should.exist(resJson.billingAccountId); should.exist(resJson.name); resJson.directProjectId.should.be.eql(128); - resJson.status.should.be.eql('draft'); + resJson.status.should.be.eql('in_review'); resJson.type.should.be.eql(body.param.type); resJson.version.should.be.eql('v2'); resJson.members.should.have.lengthOf(1); @@ -544,7 +544,7 @@ describe('Project create', () => { should.exist(resJson.billingAccountId); should.exist(resJson.name); resJson.directProjectId.should.be.eql(128); - resJson.status.should.be.eql('draft'); + resJson.status.should.be.eql('in_review'); resJson.type.should.be.eql(body.param.type); resJson.members.should.have.lengthOf(1); resJson.members[0].role.should.be.eql('customer'); @@ -620,7 +620,7 @@ describe('Project create', () => { should.exist(resJson.billingAccountId); should.exist(resJson.name); resJson.directProjectId.should.be.eql(128); - resJson.status.should.be.eql('draft'); + resJson.status.should.be.eql('in_review'); resJson.type.should.be.eql(body.param.type); resJson.members.should.have.lengthOf(1); resJson.members[0].role.should.be.eql('customer'); @@ -754,7 +754,7 @@ describe('Project create', () => { should.exist(resJson.billingAccountId); should.exist(resJson.name); resJson.directProjectId.should.be.eql(128); - resJson.status.should.be.eql('draft'); + resJson.status.should.be.eql('in_review'); resJson.type.should.be.eql(body.param.type); resJson.version.should.be.eql('v3'); resJson.members.should.have.lengthOf(1); @@ -843,7 +843,7 @@ describe('Project create', () => { should.exist(resJson.billingAccountId); should.exist(resJson.name); resJson.directProjectId.should.be.eql(128); - resJson.status.should.be.eql('draft'); + resJson.status.should.be.eql('in_review'); resJson.type.should.be.eql(body.param.type); resJson.members.should.have.lengthOf(1); resJson.members[0].role.should.be.eql('customer'); diff --git a/src/routes/projects/update.js b/src/routes/projects/update.js index ddb13a36..4f0ebee5 100644 --- a/src/routes/projects/update.js +++ b/src/routes/projects/update.js @@ -149,6 +149,9 @@ const validateUpdates = (existingProject, updatedProps, req) => { !util.hasRoles(req, [USER_ROLE.MANAGER, USER_ROLE.TOPCODER_ADMIN])) { errors.push('Don\'t have permission to update \'directProjectId\' property'); } + if ((existingProject.status !== PROJECT_STATUS.DRAFT) && (updatedProps.status === PROJECT_STATUS.DRAFT)) { + errors.push('cannot update a project status to draft'); + } return errors; };