Challenge Overview

  • Upgrade Topcoder Project API to V5 standards

Project background

  • Topcoder is streamlining its APIs and in this project we will be upgrading the existing Project API to V5 standards

  • Project API powers Topcoder connect, Topcoder Challenge V5 API and supplies data for Direct as well

Technology Stack

  • Node.js 8.11.x

  • PostgreSQL

  • Kafka

  • Docker & Docker-compose

Challenge Assets

  • Existing Topcoder Project API code (with solution from Part 1 challenge) can be found here. Please make sure to use the latest commit from `v5-upgrade` branch.
  • Topcoder API V5 standards document and Topcoder Kafka Event bus standards document is provided in the challenge forum which will be accessible after registration.

  • Swagger rewritten in V5 standards can be found here

  • List of end points to be updated as part of this challenge is provided here

Individual Requirements

Updating API response and Tests

  • Update the response structure of API endpoints according to the updated swagger. Changes required brief involves

    • Updating the status code to 400 for Validation errors

    • Remove the param wrapper in request body of the end points

    • Update pagination parameters and headers of listing end points (if pagination is supported). Please check how pagination is handled in Submission API

    • Remove the string based filters parameter and use the query parameters as specified in Swagger (if any endpoints use filters parameter)

    • Update the response structure to be in compliance with Swagger.

  • Update the tests based on above changes

  • Project API uses tc-core-library-js for JWT Authentication. The library has an issue that whenever the token is not passed or invalid, it returns 403 instead of 401. Hence you may ignore the 401 status code in Swagger for now, it will be fixed later.

Updates to Kafka Events Publishing

  • As of now, the Kafka topics used in the API to publish events are not standardized according to the Topcoder Event Bus Standards
  • Please refer to this thread to learn more about the structure of Kafka message to be used

  • Every Create / Update / Delete endpoint (including metadata endpoints) should post the event to Kafka using Bus API. Please follow the existing techniques used in the codebase. The fields to be passed in the Kafka message payload follows

    • For Create messages, every field stored in the database should be passed in the payload

    • For Update messages, it is sufficient to pass only the fields which are updated and the id of the resource which is updated

    • For Delete message, it is sufficient to pass only the id of the resource which is deleted

Behaviour of GET end points

Every GET /resources and GET /resources/{id} should follow the behaviour described here

  • Fetch data from ES based on the given filter or id
  • If there is data in ES, return it, if there is no data, try to fetch data from Database

  • If there is data in DB, return it else return empty array response or throw 404 accordingly.

Updates to Postman collection

  • Update requests in Postman collection to use dynamic values from Postman environment whenever necessary.

E.g. Check the requests in `Project Type` directory in the Postman collection. In POST (Create) request, the `key` or `id` returned by the API will be set in the Postman environment using tests. Further GET, PATCH, DELETE will use that key or id stored in the Postman environment.

Fixing Seed script

  • Please fix the issues in seeding scripts so that the command `npm run seed` and `npm run demo-data` will run without any errors and create valid test data in Database.

Validation document

  • Please create a brief validation document about how to apply your git patch file (with exact commit information) and how to validate your changes

Important Notes:

  • Please refer the end points upgraded as part of Part 1 challenge to understand about how to implement the requirements listed above
  • Ensure that there are no lint errors and every test pass.

  • If you have any doubts, Please feel free to post it in the forum. We will be happy to resolve your queries as soon as possible.



Final Submission Guidelines

  • Create a git patch file against the latest commit in `v5-upgrade` branch. Please prepare git patch file using git CLI only. Please make sure to test your patch file before submitting.

  • Create a Validation document using any format like Word, Markdown, txt file

  • Zip the patch file and Validation document and submit the zip file using the submit link in the challenge.

  • After submitting, please ensure that you are able to download your submission from Online Review

ELIGIBLE EVENTS:

Topcoder Open 2019

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30093584