Challenge Overview
Attention! This is a fast challenge! The submission phase is only 24h and all other phases have shorter timelines. Make sure you don't miss any deadline.
Challenge Objectives
-
Update the challenge model to store winner information.
-
Update the challenge-processor-es to accept the new property.
Tech Stack
-
Node.js
-
Swagger
-
DynamoDB
-
ElasticSearch
Project Background
In this series of challenges, we will build the version 5 (V5) of the challenge API.
Code Access
Challenge API
Repo: https://github.com/topcoder-platform/challenge-api
Branch: develop
Challenge Processor ES
Repo: https://github.com/topcoder-platform/challenge-processor-es
Branch: develop
Detailed requirements
As part of this challenge, you need to make the following modifications to the challenge API:
-
Add an optional winners array to the challenge model that is going to be used for storing the challenge winners in the following format: [{ userId: 12345678, handle: 'thomaskranitsas', placement: 1 }]. This should not be defined by default and should be omitted from the response unless it’s populated. Don’t just return `[]` (empty array).
-
Update the PUT/PATCH /challenges/:id endpoints to accept the winners array. The POST endpoint should not accept it.
-
There should be only one placement per member. The same member cannot have multiple placements and only one member can have a specific placement. Eg there can’t be two members with placement: 1.
-
Only an admin (or M2M/machine) or the challenge copilot can create the winners array.
-
Only an admin (or M2M/machine) can update the winners array.
-
The winners array can only be set if the challenge status is Completed.
-
Update the PUT/PATCH /challenges/:id endpoints so if the challenge status is Completed/Canceled, the challenge status should not be able to change. Eg. it should not be possible to change a Completed challenge where the winners are defined into an Active challenge.
-
Update the existing tests and create new ones to fully cover the above changes.
-
Create POSTMAN tests to cover the above changes.
-
Update the Swagger definition based on the above changes.
-
Update the challenge-processor-es so it accepts the winners array.
-
Update the tests if needed.
Should you have any questions, feel free to ask on the challenge forum!
What to Submit
Submit a git patch file for the latest commit in the develop branch of each repo.
Make sure to mention the exact commit you used so we can apply your patch without issues.