Challenge Overview
In this new challenge we are adding 3 new endpoints to topcoder Connect, continuing from previous challenges.
1. Add new models in tc-project-service for timelines (table `timelines`), milestones (table `milestones`) and productMilestoneTemplate (table `product_milestone_templates`)
2. Add new routes in tc-project-service for timeline. A new ES index should be created for timelines.
-- GET /v4/timelines/{timelineId} - to read the particular timeline
-- PATCH /v4/timelines/{timelineId} - to update a timeline
-- DELETE /v4/timelines/{timelineId} - to delete a timeline
Schema:
id long
name varchar(255)
description varchar(255)
startDate timestamp with timezone
endDate timestamp with timezone
reference varchar(45)
referenceId long
3. Add new routes in tc-project-service for milestone
-- GET /v4/timelines/{timelineId}/milestones - to list all milestones of the timeline
-- GET /v4/timelines/{timelineId}/milestones/{milestoneId} - to read the particular milestone of the timeline
-- POST /v4/timelines/{timelineId}/milestones - to add new milestone in the timeline
-- PATCH /v4/timelines/{timelineId}/milestones/{milestoneId} - to update a milestone of the timeline
-- DELETE /v4/timelines/{timelineId}/milestones/{milestoneId} - to delete a milestone of the timeline
Schema:
id long
name varchar(255)
description varchar(255)
duration int
startDate timestamp with timezone
endDate timestamp with timezone
completionDate timestamp with timezone
status varchar(45)
type varchar(45)
details json
timelineId long
order int
plannedText varchar(512)
activeText varchar(512)
completedText varchar(512)
blockedText varchar(512)
4. Add new routes in tc-project-service for productMilestoneTemplate
-- GET /v4/productTemplates/{productTemplateId}/milestones - to list all milestoneTemplates of the specific product template
-- GET /v4/productTemplates/{productTemplateId}/milestones/{milestoneTemplateId} - to read the particular milestone template
-- POST /v4/productTemplates/{productTemplateId}/milestones to create new timeline
-- PATCH /v4/productTemplates/{productTemplateId}/milestones/{milestoneTemplateId} - to update a timeline
-- DELETE /v4/productTemplates/{productTemplateId}/milestones/{milestoneTemplateId} - to delete a timeline
Schema:
id long
name varchar(255)
description varchar(255)
duration int
type varchar(45)
productTemplateId long
order int
5. Unit tests for all new endpoints
6. Swagger update is required for all new endpoints
7. Postman collection is required (please use variables for all tokens and base api url) and specify sample tokens in separate file
8. Elastic Search cluster is at version 2.3, so please don't upgrade the elasticsearch library
9. The Elasticsearch is updated using events. We must follow how project endpoint updates Elasticsearch.
10. New index 'timeline' is to be created for indexing timeline and milestones. No indexing needed for milestone templates.
11. All models have audit fields createdAt, createdBy, updatedAt, updatedBy, deletedAt and deletedBy which should be updated accordingly.
12. Parent/Child relationship e.g. timeline -> milestone, should be handled in a database transaction i.e. either both objects should be persisted/updated/deleted or none.
13. Code is provided in forum
Requirements
1. Add new models in tc-project-service for timelines (table `timelines`), milestones (table `milestones`) and productMilestoneTemplate (table `product_milestone_templates`)
2. Add new routes in tc-project-service for timeline. A new ES index should be created for timelines.
-- GET /v4/timelines - to list all timelines
- Should have filters on reference and referenceId fields e.g. of reference and referenceId are `phase` and `1234` respectively
- Should read from the timeline ES index
- Should read from the timeline ES index
-- GET /v4/timelines/{timelineId} - to read the particular timeline
- Should read from the database
-- POST /v4/timelines - to create new timeline
- Create new timeline model in database
- index it in timeline ES index (via node event - bus API)
- index it in timeline ES index (via node event - bus API)
-- PATCH /v4/timelines/{timelineId} - to update a timeline
- Update the specified timeline model in the database
- Updated the timeline ES index (via node event - bus API)
- Updated the timeline ES index (via node event - bus API)
-- DELETE /v4/timelines/{timelineId} - to delete a timeline
- Delete the specified timeline model from the database
- Delete the specified timeline model from the timeline ES index (via node event - bus API)
- Delete the specified timeline model from the timeline ES index (via node event - bus API)
Schema:
id long
name varchar(255)
description varchar(255)
startDate timestamp with timezone
endDate timestamp with timezone
reference varchar(45)
referenceId long
3. Add new routes in tc-project-service for milestone
-- GET /v4/timelines/{timelineId}/milestones - to list all milestones of the timeline
- Should return milestones in increasing order of `order` field
- Should read from timeline ElasticSearch index
- No filters or sort needed
- Should read from timeline ElasticSearch index
- No filters or sort needed
-- GET /v4/timelines/{timelineId}/milestones/{milestoneId} - to read the particular milestone of the timeline
- Should read from the database
-- POST /v4/timelines/{timelineId}/milestones - to add new milestone in the timeline
- Create new milestone model in database
- Should update the `order` field of all other milestones in the same timeline which have `order` greater than or equal to the `order` specified in the POST body. Unit tests should verify this behaviour.
- index it in timeline ES index (via node event - bus API)
- Should update the `order` field of all other milestones in the same timeline which have `order` greater than or equal to the `order` specified in the POST body. Unit tests should verify this behaviour.
- index it in timeline ES index (via node event - bus API)
-- PATCH /v4/timelines/{timelineId}/milestones/{milestoneId} - to update a milestone of the timeline
- Update the specified milestone model in the database
- Updated the timeline ES index (via node event - bus API)
- Updated the timeline ES index (via node event - bus API)
-- DELETE /v4/timelines/{timelineId}/milestones/{milestoneId} - to delete a milestone of the timeline
- Delete the specified milestone model from the database
- Delete the specified milestone model from the timeline ES index (via node event - bus API)
- Delete the specified milestone model from the timeline ES index (via node event - bus API)
Schema:
id long
name varchar(255)
description varchar(255)
duration int
startDate timestamp with timezone
endDate timestamp with timezone
completionDate timestamp with timezone
status varchar(45)
type varchar(45)
details json
timelineId long
order int
plannedText varchar(512)
activeText varchar(512)
completedText varchar(512)
blockedText varchar(512)
4. Add new routes in tc-project-service for productMilestoneTemplate
-- GET /v4/productTemplates/{productTemplateId}/milestones - to list all milestoneTemplates of the specific product template
- Should return milestones in increasing order of `order` field
- No ES needed for this endpoint
- No filters or sort needed
- No ES needed for this endpoint
- No filters or sort needed
-- GET /v4/productTemplates/{productTemplateId}/milestones/{milestoneTemplateId} - to read the particular milestone template
-- POST /v4/productTemplates/{productTemplateId}/milestones to create new timeline
- Create new milestoneTemplate model in database
- Should update the `order` field of all other milestones in the same timeline which have `order` greater than or equal to the `order` specified in the POST body
- Should update the `order` field of all other milestones in the same timeline which have `order` greater than or equal to the `order` specified in the POST body
-- PATCH /v4/productTemplates/{productTemplateId}/milestones/{milestoneTemplateId} - to update a timeline
-- DELETE /v4/productTemplates/{productTemplateId}/milestones/{milestoneTemplateId} - to delete a timeline
Schema:
id long
name varchar(255)
description varchar(255)
duration int
type varchar(45)
productTemplateId long
order int
5. Unit tests for all new endpoints
6. Swagger update is required for all new endpoints
7. Postman collection is required (please use variables for all tokens and base api url) and specify sample tokens in separate file
8. Elastic Search cluster is at version 2.3, so please don't upgrade the elasticsearch library
9. The Elasticsearch is updated using events. We must follow how project endpoint updates Elasticsearch.
10. New index 'timeline' is to be created for indexing timeline and milestones. No indexing needed for milestone templates.
11. All models have audit fields createdAt, createdBy, updatedAt, updatedBy, deletedAt and deletedBy which should be updated accordingly.
12. Parent/Child relationship e.g. timeline -> milestone, should be handled in a database transaction i.e. either both objects should be persisted/updated/deleted or none.
13. Code is provided in forum
JSON fields update
1. For POST (create)- json field should be validated as valid JSON and saved to database.
- It should be validated as valid JSON
- It would always override the existing field or add new one if the field doesn't exist in JSON object in database
- If the field being updated in the PATCH request is an array, it must override the entire array (no array merge)
Final Submission Guidelines
- Zip file with updated source code
- Swagger and Postman documentation updated