Skip to content

[$50] Create proxy endpoint GET /taas-teams/me #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maxceem opened this issue Feb 23, 2021 · 13 comments
Closed

[$50] Create proxy endpoint GET /taas-teams/me #154

maxceem opened this issue Feb 23, 2021 · 13 comments

Comments

@maxceem
Copy link
Contributor

maxceem commented Feb 23, 2021

Create a new endpoint GET /taas-teams/me which would return details about the logged-in user form V5.

  • Any logged-in user should be able to call this endpoint (same like any user can get skills)
  • This endpoint should internally call endpoint GET {TC_API}/users?externalProfile.organizationId={config.ORG_ID}&externalProfile.externalId={currentUser.userId}
    • use U-Bahn M2M token to call it
  • We should be able to optionally pass a query param enrich=true like GET /taas-teams/me?enrich=true, which should be passed to the u-bahn endpoint
  • Instead of array GET /taas-teams/me endpoint should return one object of the user if it's found
  • If the user is not found (i. e. response of u-bahn endpoint is an empty array), then return error 404
  • Update Swagger
  • Update Postman

Update

Removed support for enrich param as per #170

@maxceem maxceem added the enhancement New feature or request label Feb 23, 2021
@maxceem maxceem changed the title Create proxy endpoint GET /taas-teams/me [$50] Create proxy endpoint GET /taas-teams/me Feb 23, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Feb 23, 2021

Challenge https://www.topcoder.com/challenges/239aaa2c-5d28-457e-b319-850e6a8117a5 has been created for this ticket.

This is an automated message for maxceem via Topcoder X

@maxceem
Copy link
Contributor Author

maxceem commented Feb 23, 2021

@imcaizheng this is ready for pickup. Please, take it at last after 2 other issues.

@maxceem
Copy link
Contributor Author

maxceem commented Feb 24, 2021

Challenge https://www.topcoder.com/challenges/239aaa2c-5d28-457e-b319-850e6a8117a5 has been assigned to aaron2017.

This is an automated message for maxceem via Topcoder X

@imcaizheng
Copy link
Contributor

PR created #161

@maxceem
Copy link
Contributor Author

maxceem commented Mar 2, 2021

Payment task has been updated: https://www.topcoder.com/challenges/239aaa2c-5d28-457e-b319-850e6a8117a5
Payments Complete
Winner: aaron2017
Copilot: maxceem
Challenge 239aaa2c-5d28-457e-b319-850e6a8117a5 has been paid and closed.

This is an automated message for maxceem via Topcoder X

@maxceem
Copy link
Contributor Author

maxceem commented Mar 2, 2021

QA guidelines:

  1. Endpoint GET /taas-teams/me should return V5 u-bahn user details for the logged-in user (from Bearer token provided).
  2. This fix did small changes to a general code. Even though they small it would be nice to make a quick smoke testing of the whole process create job -> assign candidate -> choose candidate and assign resource just to make sure there are no regressions.

@sandhiyakavi
Copy link
Collaborator

@maxceem GET /taas-teams/me endpoint is returning the same response for all users.

image

@maxceem
Copy link
Contributor Author

maxceem commented Mar 2, 2021

Thank you @sandhiyakavi this is a very good catch.

I did some debugging over there, looks like there is some issue in U-bahn API:

  • If we make a request with enrich=true everything works well, for example https://api.topcoder-dev.com/v5/users?enrich=true&externalProfile.organizationId=36ed815b-3da1-49f1-a043-aaed0a4e81ad&externalProfile.externalId=40159127 returns an array with one user
     [{"lastName":"Admin","updatedBy":"tcAdmin","created":"2021-01-06T17:10:45.336Z","handle":"max.admin","firstName":"Max","externalProfiles":[{"organizationId":"36ed815b-3da1-49f1-a043-aaed0a4e81ad","updatedBy":"tcAdmin","createdBy":"NaN","isInactive":false,"created":"2021-01-06T17:10:45.738Z","organization":{"updatedBy":"tc-Copilot","createdBy":"tc-Copilot","created":"2020-05-05T11:01:31.334Z","name":"Topcoder","skillProviders":[{"organizationId":"36ed815b-3da1-49f1-a043-aaed0a4e81ad","updatedBy":"tc-Copilot","createdBy":"tc-Copilot","created":"2020-05-05T11:01:31.334Z","skillProviderId":"7637ae1a-3b7c-44eb-a5ed-10ea02f1885d","id":"909da0a2-3c46-4ec9-9a6d-f6f3829fa07a","updated":"2020-05-05T11:02:10.574Z"}],"id":"36ed815b-3da1-49f1-a043-aaed0a4e81ad","updated":"2020-05-05T11:02:10.574Z"},"externalId":"40159127","id":"ef25ff9c-8a67-43b1-97c9-04e4cc1d0c02","uri":null,"updated":"2021-01-06T17:10:45.738Z","userId":"077fd578-7463-457f-b6ef-22c02178d7f5"}],"createdBy":"NaN","id":"077fd578-7463-457f-b6ef-22c02178d7f5","updated":"2021-01-06T17:10:45.336Z"}]
  • but if we are making the same request without enrich, then U-bahn endpoint returns some random array of multiple users instead of the required user, I guess it doesn't filter result by externalId in such case, for example URL https://api.topcoder-dev.com/v5/users?enrich=false&externalProfile.organizationId=36ed815b-3da1-49f1-a043-aaed0a4e81ad&externalProfile.externalId=40159127 returns
     [
         {"lastName":"Underwood","firstName":"Christina","updatedBy":"tcAdmin","createdBy":"Talend","created":"2021-01-20T03:56:20.459Z","handle":"christina_uw","id":"79ce2a3e-7679-48cf-8ac9-0a8ca4c4b463","updated":"2021-01-20T03:56:20.459Z"},
         {"lastName":"Mess","firstName":"Mess","updatedBy":"tcAdmin","createdBy":"Talend","created":"2021-01-20T03:56:20.443Z","handle":"mess","id":"98ec2c16-442e-4b61-8ad1-66123ee37d3c","updated":"2021-01-20T03:56:20.443Z"},
         {"lastName":"Chennaveerappa Mruthyunja","firstName":"Nagendrakumar","updatedBy":"tcAdmin","createdBy":"Talend","created":"2021-01-20T03:56:20.459Z","handle":"cmnkumar.123","id":"4dfc6090-4ba8-4387-b5c4-584fcef982ba","updated":"2021-01-20T03:56:20.459Z"},
         ... and so on
     ]

@nkumar-topcoder maybe we could ask someone to have a look at this from U-bahn team?

@maxceem
Copy link
Contributor Author

maxceem commented Mar 2, 2021

On the second thought, I guess this is a kind of expected behavior in U-Bahn. We cannot filter by externalId if we don't enrich profile as externalId is a part of externalProfile. So I guess the solution would be

  • hardcade enrich to true and don't allow set/unset it via GET /taas-teams/me API call.
  • log an issue for U-bahn API so it should return explicit error if we try to filter by externalProfile without providing enrich=true with the description of why this error happens, so users of this API are aware of this.

@maxceem
Copy link
Contributor Author

maxceem commented Mar 10, 2021

@sandhiyakavi this is now ready for QA on DEV. Please, note, that we've removed support for enrich param as described in another issue #170

@maxceem
Copy link
Contributor Author

maxceem commented Mar 10, 2021

[400]: Failed to update challenge. Detail: Cannot update prizeSets for challenges with status: Completed!

This is an automated message for maxceem via Topcoder X

@sandhiyakavi
Copy link
Collaborator

Verified in Dev Env. endpoint GET/taas-teams/me is fetching the correct user details.

  1. Correct user details fetched.

BM

connectm

  1. If invalid token used.

401_unthorized

  1. If the user is not found.

invalid tokrn issuer

@sandhiyakavi
Copy link
Collaborator

Verified in Prod Env. Details are correctly displayed.

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants