-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enhance User Access Token Flow with PR Count Tracking #16
Conversation
….json, modified schema.prisma, app.js, router.js, GithubPassportStrategy.js, and Middlewares.js files"
…mma-backend into mitgajera/main
// Function to fetch pull request count | ||
const getPullRequestCount = async (githubId, accessToken) => { | ||
try { | ||
const response = await axios.get(`https://api.github.com/search/pulls?q=author:${githubId}+is:public`, { |
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.
why fetching user's all prs, we don't want his all pr count, we want pr counts of our projects, so you can remove this thing
// router.post('/logout', controller.logout); // Add logout route | ||
router.get('/access_token', controller.getAccessToken); // Add access token route | ||
// GitHub authentication routes | ||
router.get('/github', passport.authenticate('github', { scope: ['user:email'] })); |
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.
comment these routes
hey @mitgajera |
@mitgajera good work, but please keep small changes in a single commit and don't include changes which are not relatable to issue, you can create separate issue for that. |
@jalaym825 |
closing the pr for now, fix all things and raise new pr. |
Overview
This pull request (PR) introduces improvements to the user authentication process by including the retrieval and updating of pull request (PR) counts for users during the access token flow.
Issue fixed: #14
Changes Made
getPullRequestCount
function that retrieves the total count of pull requests authored by the user from GitHub's API.prCount
field, initialized to 0 for new users.getAccessToken
function to:Why This Change?
By keeping track of the number of pull requests, we can better evaluate user engagement and contributions within our application. This enhancement will enable us to use this data for analytics and user recognition features in future iterations.
Testing