Skip to content

Commit 20f0b3e

Browse files
committed
updated variable name
1 parent 3d11b0b commit 20f0b3e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

controllers/users.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,11 @@ const filterUsers = async (req, res) => {
466466

467467
// one time script function to perform the migration - adding github_user_id field to the document
468468
const migrate = async (req, res) => {
469+
// pat yet to be generated
469470
const authToken = `${config.get("githubOauth.patToken")}`;
470471
// converting the `authToken` string into Base64 format
471472
const encodedToken = Buffer.from(`${authToken}`).toString("base64");
472-
const usernameNotFound = [];
473+
const usersNotFound = [];
473474
let countUserNotFound = 0;
474475
try {
475476
// Fetch user data from GitHub API for each document in the users collection
@@ -500,11 +501,11 @@ const migrate = async (req, res) => {
500501
.catch((error) => {
501502
if (error.response && error.response.status === 404) {
502503
countUserNotFound++;
503-
const userNotFound = {
504+
const invalidUsers = {
504505
name: `${userName}`,
505506
username: `${githubUsername}`,
506507
};
507-
usernameNotFound.push(userNotFound);
508+
usersNotFound.push(invalidUsers);
508509
} else {
509510
// Other error occurred
510511
logger.error("An error occurred at axios.get:", error);
@@ -519,7 +520,7 @@ const migrate = async (req, res) => {
519520
return res.status(200).json({
520521
message: "All Users github_user_id added successfully",
521522
data: {
522-
invalidUsers: usernameNotFound,
523+
invalidUsers: usersNotFound,
523524
totalCount: countUserNotFound,
524525
},
525526
});

0 commit comments

Comments
 (0)