-
Notifications
You must be signed in to change notification settings - Fork 201
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
Feat/GitHub duplication #1818
Feat/GitHub duplication #1818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the following:
- Test coverage screenshots
- Integration tests
controllers/users.js
Outdated
const userId = userDoc.id; | ||
batchWrite.update(userDoc.ref, { github_user_id: null }); | ||
|
||
const promise = fetch(`https://api.github.com/users/${githubUsername}`, requestOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we considered GitHub's rate limits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc says that it is 5000 requests per hour for authenticated users. And I do not think that this will cause any issue as we anyway have less than 1k users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also says we cannot make more than 900 calls per minute on a single route. I think we have around 3000 users docs in our prod db.
https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits
Done |
…-Squad/website-backend into feat/github-duplication
controllers/users.js
Outdated
const userId = userDoc.id; | ||
batchWrite.update(userDoc.ref, { github_user_id: null }); | ||
|
||
const promise = fetch(`https://api.github.com/users/${githubUsername}`, requestOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also says we cannot make more than 900 calls per minute on a single route. I think we have around 3000 users docs in our prod db.
https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits
// WARNING!! - One time Script/Route to do migration | ||
router.post( | ||
"/migrations", | ||
authenticate, |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
This route handler performs
authorization
This route handler performs
authorization
…-Squad/website-backend into feat/github-duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Unit tests should have been written for models and middleware instead of only having integration tests.
Please also get approvals from @prakashchoudhary07 / @iamitprakash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you test case stats
Date:
28 Dec 2023
Developer Name:
Joy Gupta
Issue Ticket Number:-
Reference PR:-
Description:
github_user_id
into user schema to avoid user duplicationgithub_user_id
upon logging if it does not existsIs Under the Feature Flag
Database changes
Breaking changes (If your feature is breaking/missing something please mention pending tickets)
Is Development Tested?
Tested in staging?
Test Cases
Test Stats
Add relevant Screenshot below
1. Github user id should be added upon logging in
Screen.Recording.2023-12-28.at.9.59.42.AM.1.mov
2. Should add github_user_id after executing the script
Before
Execution log
Updated Users