Skip to content

Timeline and Milestone REST API + Misc Fixes #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 8, 2018
Merged

Timeline and Milestone REST API + Misc Fixes #90

merged 3 commits into from
Jun 8, 2018

Conversation

ngoctay
Copy link
Contributor

@ngoctay ngoctay commented Jun 6, 2018

  • Merge the code with "topcoder Connect - Timeline and Milestone REST API" challenge (30065695)
  • (Review) Milestone: startDate, status should be required fields
  • (Review) When deleting a timeline, it should be cascaded to it's milestone as well
  • (Review) Milestone completionDate must not be before startDate
  • (Review) Postman: DELETE should not have request body
  • (Review) Postman: add at least 1 negative test case for the POST end points
  • (Paulo) Don’t allow startDate and endDate of milestones out of bound of it’s parent timeline.
    If startDate or endDate for timeline is updated, children must validated and changed accordingly
  • (Paulo) GET /timelines, /timelines/{id} should return the associated milestones
  • (Paulo) Update milestone order for PATCH endpoint

ngoctay added 2 commits June 7, 2018 00:07
… API" challenge (30065695)

- (Review) Milestone: startDate, status should be required fields
- (Review) When deleting a timeline, it should be cascaded to it's milestone as well
- (Review) Milestone completionDate must not be before startDate
- (Review) Postman: DELETE should not have request body
- (Review) Postman: add at least 1 negative test case for the POST end points
- (Paulo) Don’t allow startDate and endDate of milestones out of bound of it’s parent timeline.
  If startDate or endDate for timeline is updated, children must validated and changed accordingly
- (Paulo) GET /timelines, /timelines/{id} should return the associated milestones
- (Paulo) Update milestone order for PATCH endpoint
@ngoctay
Copy link
Contributor Author

ngoctay commented Jun 6, 2018

@coderReview @vikasrohit Please have a look.

// Milestone 2: order 3
// Milestone 3: order 4
// Milestone 4: order 0
setTimeout(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not correct, since 0 doesn't have anyone, the other orders are not changed.

}, 3000);
});
});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a few more tests for order -> like changing order with only 1 item in list and 2 items in list (these are edge cases where we can get errors if not taken care properly. or even negative order number).

also, try this case were we have this list: 1, 3, 4 and we update 4 -> 2 (this is just update, won't have any order change since order 2 is available), and 1, 2, 4 and we update 4 -> 2 (this case we end like this: 1, 2 (it was 4), 3).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added new tests. Please check the latest commit:

157bb75

name: { type: DataTypes.STRING(255), allowNull: false },
description: DataTypes.STRING(255),
duration: { type: DataTypes.INTEGER, allowNull: false },
startDate: { type: DataTypes.DATE, allowNull: false },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Review) Milestone: startDate, status should be required fields

// Update the deletedBy, then delete
timeline.update({ deletedBy: req.authUser.userId })
.then(() => timeline.destroy())
// Cascade delete the milestones
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Review) When deleting a timeline, it should be cascaded to it's milestone as well

duration: Joi.number().integer().required(),
startDate: Joi.date().required(),
endDate: Joi.date().min(Joi.ref('startDate')).allow(null),
completionDate: Joi.date().min(Joi.ref('startDate')).allow(null),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Review) Milestone completionDate must not be before startDate

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ngoctay I think it should not be after endDate, wouldn't you agree?

duration: Joi.number().integer().required(),
startDate: Joi.date().required(),
endDate: Joi.date().min(Joi.ref('startDate')).allow(null),
completionDate: Joi.date().min(Joi.ref('startDate')).allow(null),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Review) Milestone completionDate must not be before startDate

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ngoctay I think it should not be after endDate, wouldn't you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it should not be after endDate.
I think startDate and endDate looks like a plan. The completionDate is the actual completed date.
Actual completed date can be before or after then planned endDate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@coderReview coderReview merged commit dcaef1c into topcoder-platform:feature/dev-challenges Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants