Topcoder - legacy member processor updates

Key Information

Register
Submit
The challenge is finished.

Challenge Overview

Challenge Objectives

  • Refactor the existing code to ensure we don’t damage existing data in our DB.

Project Background

We’re in the process of revamping our platform and adding support to store more information about our users as traits in order to improve the overall user experience in our platform.

Technology Stack

  • Node.js

  • Kafka

  • Docker and Docker Compose

  • InformixDB

  • AWS

Code Access

Existing code:

Branch: develop

Detailed requirement

1. Code Refactoring

Currently, the code assumes that the payloads will contain all required information and it executes queries to create or update data in the legacy InformixDB. As a result, if some data (eg firstName) is missing in the payload, the processor will override the existing values in the DB with empty strings (or null). This is a serious issue as it can damage our data. As a quick fix, we added some input validation (using Joi) that sets all fields as required.

 

You need to refactor the code to only update the properties that exist. For example, if the payload only contains the firstName, then only update the first_name column in the user table. Do not touch any other columns if the new data does not exist in the payload.

 

The required properties for each table should be configurable. All required properties must be present in the payload for `insert into…` operations.

2. Update tests

  • Update the tests based on the above changes.

  • Create strong negative tests to cover all scenarios.

 

Feel free to ask on the challenge forum!

What to Submit

Submit:

  • Git patch for the latest commit in the develop branch. Make sure to note the exact commit you used so the reviewers can apply your patch file.

  • Instructions on how to apply your patch and test your submission.



Final Submission Guidelines

Please read above.

ELIGIBLE EVENTS:

Topcoder Open 2019

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30085302