Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/routes/projects/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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))
Expand Down
12 changes: 6 additions & 6 deletions src/routes/projects/create.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down
3 changes: 3 additions & 0 deletions src/routes/projects/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down