Challenge Overview
Challenge Objectives
-
Add support for isActive flag on the Resource model.
-
Update related applications to reflect the change.
Tech Stack
-
Node.js
-
DynamoDB
-
ElasticSearch
-
Docker
Code Access
Repos:
-
https://github.com/topcoder-platform/legacy-challenge-resource-processor
-
https://github.com/topcoder-platform/legacy-challenge-migration-script
Branch: develop
Detailed Requirements
As part of this challenge, you need to make the following changes in the Resources API and all related applications (repos listed above):
Update Resources API
-
Update the Resource model to have an isActive (boolean, default to true) flag.
-
This isActive flag is read-only for regular users. Only M2M can update this property. The idea is that it’ll be true while the challenge is active and then set to false by the challenge autopilot (or a similar processor - out of scope).
-
Update the GET /resources endpoint so we can filter based on the isActive property.
-
Update the listChallengesByMember method to support filtering based on the isActive property.
-
Update Swagger/Postman to reflect the changes.
Update the challenge resource processor
Update the https://github.com/topcoder-platform/resource-processor to listen to the following topic:
-
challenge.notification.update
Once receiving a message on this topic, the processor should fetch the challenge by calling the V5 API and If the challenge status has changed from “Active” to “Completed” or “Cancelled”, it must:
-
Call the Resources API using an M2M to fetch all resources for the challenge
-
Update each resource to set the isActive flag to false.
Update related apps
-
Make sure the Joi validation passes on the https://github.com/topcoder-platform/resource-processor-es, the https://github.com/topcoder-platform/resource-processor as well as the https://github.com/topcoder-platform/legacy-challenge-resource-processor
-
Update the https://github.com/topcoder-platform/legacy-challenge-migration-script to include the `isActive` flag when migrating Resources over into V5
-
Create a migration script on the https://github.com/topcoder-platform/legacy-challenge-migration-script project that will update all existing resources on v5 to include the `isActive` flag (in src/scripts/migrations).
Unit/e2e testing
Where applicable, tests should be updated to reflect the above changes.
What to submit
For each repo, your submission must include a git patch file for the latest commit in the develop branch.
Make sure to mention the commits you used on a txt file so we don’t face any issues applying your patch file.