Challenge Overview
Challenge Objectives
-
To replace MongoDB database with DynamoDB
-
To add a new endpoint to read group id(s) to consider
-
To correct the tests
Project Background
-
During Topcoder Events, such as TCO, we prepare the leaderboard rankings based on the reviews of submissions made specifically for these events
-
Leaderboard api is meant to facilitate interaction with the database to store the leaderboard details
Technology Stack
-
Nodejs version 10
-
Mongodb (which will be replaced with DynamoDB)
Code access
For the leaderboard api, you can find the code here. Make sure you use the develop branch
Individual requirements
To replace MongoDB database with DynamoDB (Major Requirement)
-
The code base currently uses MongoDB as its database
-
We would like to start using DynamoDB instead
-
Replace all occurrences of using MongoDB with their DynamoDB equivalents
-
You need to support sorting and pagination of data too. This means that the pagination parameters will change (use the lastEvaluatedKey feature) and that is ok, but support pagination.
-
The api client (besides pagination) should not expect any other changes to the api usage. That is, the request and response should be the same as before.
To add a new endpoint to read group id(s) to consider (Major Requirement)
-
We currently have a feature in the api, where we can define the group ids in the configuration and these are read by the API.
-
We would like to instead move this to the database. Provide a new endpoint:
-
GET /leaderboard/groups
-
This will list all the groups (array of numbers)
-
No pagination needed
-
-
POST /leaderboard/groups/:groupId
-
Adds the groupId as a number to the list of groups in the database
-
-
DELETE /leaderboard/groups/:groupId
-
Removes the groupId from the list of groups in the database
-
-
-
With this, during runtime, you need to read the list of groups from the database.
-
Do not cache this. Always read from the database
Update / Provide tests (Dedicated section in scorecard)
-
You need to add / update the unit and e2e tests with a code coverage exceeding 80%.
-
You need to use nock to mock and mocha and chai for the tests.
Deployment guide and validation document
Update the deployment guide of api as needed for this contest.
Important Notes
-
Follow existing conventions used
-
Ensure there are no lint errors during submission
-
You need to update the POSTMAN collection of the leaderboard api (Minor Requirement)
Final Submission Guidelines
You can submit a git patch that contains your changes.