Topcoder Project Service - Only list project with pending invites

Register
Submit a solution
The challenge is finished.

Challenge Overview

Fix request to Elastic Search to only list project with invites in “pending” status, but not “requested”.

Project Background

Topcoder Project Service is the main backend service of Topcode Connect – the client-facing application of Topcoder. We have an endpoint that returns the list of projects. For non-admin users, we return only projects which users are invited to or already members of. We have 2 status of active invites: “pending” and “requested”. “pending” status means that user has been invited and can see the project in the project list to be able to accept or decline the invitation. But “requested” status of invitation means that invite by itself is not yet approved by a special user, and in such case, users shouldn’t see projects where they have “requested” invite. Currently, users may list the projects if they have an invitation in any status.

Technology Stack

  • Node.js

  • ElasticSearch

Code access

The work for this challenge has to be done in one repository:
- Project Service repo https://github.com/topcoder-platform/tc-project-service branch master commit 4b1bf7cc23dc5384f14b99afe8b7388709cb7367 or later.

- Config for local setup is provided on the forum.

Individual requirements

  • We have an endpoint to list the projects “GET /v5/projects”. 

  • When we get the list of projects from ES (Elastic Search Index) it should return only projects for non-admins users who are invited, if invitation status is “pending”. We also have a fallback request from DB which works correctly, see code.

  • Implement at least 2 unit tests:
    - `should return projects where a non-admin user has an invitation in “pending” status`
    - `should NOT return projects where a non-admin user has an invitation in “requested” status`

  • Hint. To create an invitation with `requested` status use manager user token and send a request to the “POST /v5/projects/{projectId}/members/invite/” endpoint with body `{"userIds":[40152855],"role":"copilot"}`.

General requirements

  • Existent unit tests should pass.

  • Lint should pass (don’t disable eslint rules).

  • Git patch should be without errors or warnings.



Final Submission Guidelines

Submit a zip file which would include:

  • Git patch with changes you’ve made to the code in our repository.

Additionally, the winner would be required to raise a pull request to the repository after the challenge is completed.

Review style

Final Review

Community Review Board

Approval

User Sign-Off

Challenge links

ID: 30111699