Key Information

Register
Submit
The challenge is finished.

Challenge Overview

Challenge Objectives

 
  • Add machine token support to the api endpoints

  • Publish terms related events to the event bus


Project Background

 
  • Topcoder services keep the terms of use in now legacy Informix database. Topcoder v2 API provides access to some of the terms management features. This project aims to build a standalone Terms microservice by following Topcoder v5 API standards  

  • In a previous challenge we have migrated the v2 API term endpoints to the new service and built the CRUD layer for terms and resource terms

  • Once the API is built, deployed and tested, we will create migration scripts, update all apps and services that depend on the current v2 API

 

Technology Stack

 
  • NodeJS

  • Postgres

  • Sequelize

  • Express

 

Code access

 

Base code is available in the project repository, dev branch.

 

Individual requirements

 
  1. Add Machine token support

The following endpoints need to be accessible using a machine token (required scope indicated for each endpoint):

  • POST/PUT/PATCH/DELETE terms (terms:write) - create/update terms

  • GET /terms and GET /terms/:id (terms:read) - list and get terms

  • POST/PUT/PATCH /terms/reference (terms:write) - create/update reference terms

  • GET /terms/reference/:id (terms:read) - list and get reference terms

  • GET /terms/user/:userId/reference (terms:read) - check if a user has agreed to terms for a resource

    Machine token handling is a feature provided by the Topcoder Core Library middleware - the available scopes are added to req.authUser.scopes if req.authUser.isMachine=true

  1. Publish terms related events to the event bus
    The following events should be published to the event bus (event topic indicated for each event):

  • User agreed to terms (terms.notification.updated) - related endpoint is POST /terms/:termsOfUseId/agree. Payload should include the termsId, userId, timestamp(created_at)

  • Resource terms created (terms.notification.created) - related endpoint is POST /terms/reference. Payload should include resource terms id, reference, reference id, tag and a timestamp

    Posting to bus API is implemented in other Topcoder services and we can reuse the similar structure. See the submissions-api for an example.

 

General for all requirements

 

Logging is required for all services. Unit tests are required for all new/updated controllers and services.


Submission Guidelines

  • Submit a Readme with details on how to configure, build, run and test the service changes

  • Submit Swagger and Postman files for verification



Final Submission Guidelines

See above

ELIGIBLE EVENTS:

Topcoder Open 2019

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30093814