Skip to content

Commit e54c7ba

Browse files
committed
feat: remove validation of timeline.startDate when creating a new milestone
1 parent 9df0aca commit e54c7ba

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

src/routes/milestones/create.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ module.exports = [
6060
});
6161
let result;
6262

63-
// Validate startDate and endDate to be within the timeline startDate and endDate
63+
// Validate startDate is not earlier than timeline startDate
6464
let error;
6565
if (req.body.param.startDate < req.timeline.startDate) {
6666
error = 'Milestone startDate must not be before the timeline startDate';
67-
} else if (req.body.param.endDate && req.timeline.endDate && req.body.param.endDate > req.timeline.endDate) {
68-
error = 'Milestone endDate must not be after the timeline endDate';
6967
}
7068
if (error) {
7169
const apiErr = new Error(error);

src/routes/milestones/create.spec.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -441,23 +441,6 @@ describe('CREATE milestone', () => {
441441
.expect(422, done);
442442
});
443443

444-
it('should return 422 if endDate is after the timeline endDate', (done) => {
445-
const invalidBody = {
446-
param: _.assign({}, body.param, {
447-
endDate: '2018-06-13T00:00:00.000Z',
448-
}),
449-
};
450-
451-
request(server)
452-
.post('/v4/timelines/1/milestones')
453-
.set({
454-
Authorization: `Bearer ${testUtil.jwts.admin}`,
455-
})
456-
.send(invalidBody)
457-
.expect('Content-Type', /json/)
458-
.expect(422, done);
459-
});
460-
461444
it('should return 422 if invalid timelineId param', (done) => {
462445
request(server)
463446
.post('/v4/timelines/0/milestones')

0 commit comments

Comments
 (0)