Skip to content
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

Added profile routes #167

Closed
wants to merge 2 commits into from
Closed

Conversation

NOOB-3301
Copy link

I have added more profile routes and controller

Fixing #166

Routes:

/profile/getprofile - get user profile
hyperss-2025-01-14_21-53-10

/profil/editprofile - edit user profile , added the functionality for adding user images

hyperss-2025-01-14_21-54-36
/profile/quizStatus - get user participated quizes

hyperss-2025-01-14_21-59-12

Copy link

gitguardian bot commented Jan 14, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- - Cloudinary API keys ec90e07 backend/utils/cloudinary.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@NOOB-3301 NOOB-3301 changed the title Added rofile routes Added profile routes Jan 14, 2025
@techy4shri
Copy link
Collaborator

Rebase to another branch first, you cannot work on the restart branch.

Copy link
Collaborator

@techy4shri techy4shri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am closing this PR because it has quite a few issues and honestly disregards our code style. I would recommend analysing and understanding the codebase first before starting to work on an issue. That would be beneficial to both the team and the contributor.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not change package-lock.json file unless prompted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when i start it, by running npm run dev , it is giving error conflicting packages so it deleled the node modules and package-lock.json folder

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not needed, you are not supposed to hardcode this for security reasons.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is just env file , canbe changed anytime, when anyone start the server they can just copy paste this in their env file

}

if (username) user.username = username;
if (email) user.email = email;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are you checking whether the email format is correct?


if ((req as MulterRequest).file) {
const uploaded_url = await upload_on_cloudinary((req as MulterRequest).file.buffer);
console.log("Uploaded URL:", uploaded_url);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log("Uploaded URL:", uploaded_url);
This is going to print it...why?
What is this code snippet doing?

if (typeof uploaded_url === "string" && uploaded_url) {
user.picture = uploaded_url;
} else {
console.error("Invalid URL returned from Cloudinary:", uploaded_url);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never ever mention the name of file in error, this is robotic and the user doesn't need to know.

}
}

console.log("Updated Picture URL:", user.picture); // Check the value before saving
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated profile picture....not url

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good

// const { v2: cloudinary } = require('cloudinary');
import {v2 as cloudinary} from 'cloudinary'
import streamifier from 'streamifier'
// const streamifier = require('streamifier');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you have this line here? redundant comments are against best practices and I would like us to keep only necessary comments.

secure: true,
});

const upload_on_cloudinary = async (fileBuffer:Buffer, folderName = "demo") => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why demo folder name?

}
}
);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, this won't do.

@techy4shri techy4shri closed this Jan 15, 2025
@techy4shri techy4shri added wontfix This will not be worked on BLOCKED This won' be reoponed. labels Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLOCKED This won' be reoponed. wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants