Challenge Overview

 

Challenge Objectives

 
  • Create base code for Flask+MongoDB API

  • Create user management endpoints and authentication interceptors

  • Write unit tests

 

Project Background

 
  • Telecom providers sell products such as broadband and mobile phone contracts. These contracts consist of products of different types and capabilities and that are then sold in different markets. In this project we’re building a forecasting tool to predict variables like volume base, gross adds, churn, net migrations, average revenue per customer, etc

  • In this challenge we’re creating base code for the project and implementing sample endpoints

  • In the follow-up challenges we will develop the backend API, integrate with the frontend and third party APIs and build a test suite.

 

Technology Stack

 
  • Python

  • Flask

  • MongoDB

 

Resources

 

We’re starting a new project so it is up to you to create the project structure

 

Individual requirements

 
  1. Create base code for the project
    Create a new Python 3 project with Flask, MongoDB, MongoEngine and mongomock. Document local and Heroku (docker) deployment instructions. Set up pylint with PEP-8 and autopep8, pytest and test coverage report.
    Write a dockerfile to build and run the app. Make sure to follow dockerfile best practices:
    - https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
    - https://docs.openshift.com/enterprise/3.0/creating_images/guidelines.html#general-docker-guidelines
    Specifically the dockerfile should use multistage build with three stages:
    - first stage builds the development image only copy the requirements.txt and install dependencies. App code should be mounted as a volume so we don’t need to rebuild the image each time the source changes
    - second stage should copy all the app code and run application tests
    - third stage should install only dependencies needed for the app (so we don’t need linter, test dependencies, etc) and app code - anything not needed for runtime should be removed from the final image
    Also, create a docker-compose config to run mongoDB and the app (dev stage) service

  2. Implement user management endpoints
    The app will have two user roles: regular user and admin. Implement CRUD endpoints for managing app users - only admin will be able to access these endpoints. Make sure not to store plain text password in the database.

  3. Implement authentication filters and login endpoint
    All endpoints except for login will require a valid JWT token

  4. Implement unit tests
    Write unit tests for the security and user management endpoints. Minimum test coverage is 80%

 

General for all requirements

 

Use camelCase for all JSON data attribute names, TitleCase for entity names. All sensitive parameters should be configurable via environment variables.

 

What To Submit

 

Submit the full source code

Submit a README document with configuration and deployment details




 

Final Submission Guidelines

See above

ELIGIBLE EVENTS:

Topcoder Open 2019

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30093962