Topcoder Connect - Organization configs

Register
Submit a solution
The challenge is finished.

Challenge Overview

Challenge Objectives

When a customer presses the link to create a new project in Topcoder Connect app, we have to redirect him to a special page if he is a part of an organization which has such a page.

To achieve this we will need to add the ability to handle organization configs in the Project Service.

Project Background

Topcode Connect is client facing application of Topcoder. Customer use Topcoder Connect to input requirements of their projects, then managers and copilots take it from there.

Currently, when customers click “+” button to create a new project, all of them see the same set of projects types they can create. Some of our customers would like to have a custom set of projects types to create. So in this challenge, we are going to implement the ability for some customers to have a custom page when creating a new project. We won’t create the custom pages in this challenge, only redirect users to special URLs.

Technology Stack

  • Node.js

  • PostgreSQL

  • React

  • Redux

  • CSS Modules

Code access

The work for this challenge has to be done in two repositories:
- Project Service repo https://github.com/topcoder-platform/tc-project-service dev branch

- Connect App repo https://github.com/appirio-tech/connect-app dev branch

Individual requirements

Implementation overview

Currently, we don’t have a place where to store links for an organization. So this challenge will have two steps:
- in Project Service create a table in the DB to store configs for organizations and add an endpoint to retrieve configs

- in Connect App call the endpoint to get configs, and if an organization which user belongs to has special URL for creating a new project page, we would replace general “create new project” link with a special one.
- Note: as we don’t have organizations we will use groups users belongs to as organizations.

1. Implement organization DB table/model/CRUD in the Project Service

  • In Project Service add a new table org_config together with a corresponding model orgConfig
    Table has three columns:
    - id: bigint NOT NULL
    - orgId: character varying(45) NOT NULL
    - configName: character varying(45) NOT NULL
    - configValue: character varying(512)

  • Create a migration script for creating this table in the DB inside /migrations folder

  • Create CRUD endpoints:
    GET /orgconfig - get a list of records (permission anyone)
    - filter query param should be mandatory, together with orgId property
    - the filter should let us filter by
     - orgId which can be one id, example /orgconfig?filter=orgId%3D20000145 or a list of ids, example /orgconfig?filter=orgId%3D20000145%2C20000146%2C20000147
     - configName, example /orgconfig?filter=configName%3Dproject_catalog_url
    Combination of both of them: /orgconfig?filter=orgId%3D20000145%26configName%3Dproject_catalog_url
    GET /orgconfig/id - get a config record (permission anyone)
    POST /orgconfig - create a config record (permission projectAdmin)
    PATCH /orgconfig/id - update a config record (permission projectAdmin)
    DELETE /orgconfig/id - delete a config record (permission projectAdmin)

  • Unit tests should be implemented similarly to existent endpoints

  • In general, follow the existent code

2. Replace default “create new project” link with the specific link in Connect App

For development purposes, you can use a user `pshah_manager`. Credentials for the user are provided on the forum. The user belongs to three groups for testing.

  • When we load user data we should additionally load the list of groups the user belongs to using the next endpoint: /v3/groups?memberId=40153891&membershipType=user

  • After we get the list of groups a logged-in user belongs to, we should get configs for these groups using the endpoint we’ve created in Project Service. We will use group id as orgId when retrieving org configs.

  • Keep loaded organization config values in the Redux store path loadUser.orgConfig

  • For testing, you would need to create config records with
    orgId: the group id user belongs to
    configName: project_catalog_url
    configValue: any route on Connect App for testing, for example: `/projects/7663`

  • If the user has project_catalog_url defined for one organization, all the links to `/new-project` inside Connect app should be replaced with a link defined by project_catalog_url.
    NOTE: links which start from `/new-project` but have a subpath should stay as they are. Example `/new-project/app` - we shouldn’t update such links. Only links to `/new-project` should be updated with a link from project_catalog_url.

  • If the user doesn’t have project_catalog_url defined for any ornazation, or he has project_catalog_url defined for more than 1 organization. Link `/new-project` should stay as it is.

  • There are at least two places where `/new-project` link is used: https://monosnap.com/file/STAP4AVV3GFvjTLA7WMBKItvYLaM4r top right corner, and a card when card view mode is selected. Maybe some other.

General requirements

  • Lint should pass

  • Existent unit tests should pass

Local development note

When developing locally you would need to point Connect App to user locally deployed Project service. It should be fine as we only need to access the project list page http://local.topcoder-dev.com:3000/projects during testing.

In case you would have difficulties to use locally deployed Project Service with Connect app. I think it would be ok not to point Connect App to use locally deployed Project Service and keep using the deployed DEV Project Service. And just hardcode during testing the endpoint URL for /orgconfig. But don’t submit hardcoded endpoint, just mentioned in submission readme if for testing we have to hardcode it, or we can point the Connect App to use locally deployed Project Service.

Final Submission Guidelines

  • Patch to the dev branch of Connect App

  • Patch to the dev branch of Project Service

  • Short submission readme which includes:
    - which commit you used to create patches
    - some essential steps to test the submission

Review style

Final Review

Community Review Board

Approval

User Sign-Off

Challenge links

ID: 30081357