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

[FEATURE] : Add Profile Page which shows user details and No. of Blog Post by User #393

Open
Adityajparmar37 opened this issue Jun 3, 2024 · 5 comments
Labels
feature Adding new feature on top of the existing code

Comments

@Adityajparmar37
Copy link
Contributor

Description

Having a Profile Page is good option. As it is very usefully to know user itself details and can know total how many number of post user has made .

Use Case

1 ) Able to know user basic details like username and email
2 ) Able to change/Update password
3 ) Able to look over how many number of Blog post user has done

Additionally able to

4 ) Perform CRUD operation over the blog user has post if possible

This will uplift your website.

Proposed Solution

1 ) As soon as user login/sign-in the website then added the user details to Local Storage of Browser.
2 ) Take the User details from Local Storage and show it as Profile Page
3 ) Create 1 API which take all information of User and check if any information has been change by user then update the user details in DB .
4 ) Create another API which take user email or username and find the user Blog post details form DB and fetch it . Then Show the details of user ' s blog post.

Eg. router.put(
"/update",
authMid,
handler(async (req, res, next) => {
try {
const formData = req.body;
const userId = req.user.id;
const existingProfile =
await Model.findById(userId);

  // Check if password is provided and update it
  if (formData.password) {
    const salt = await bcrypt.genSalt(10);
    formData.password = await bcrypt.hash(
      formData.password,
      salt
    );
  }

  // Update the user profile with the new data
  const updatedProfile =
    await Model.findByIdAndUpdate(
      userId,
      formData,
      { new: true }
    );

  res.json({
    updatedProfile,
    update: true,
  });
} catch (error) {
  console.log(error);
  next(error);
}

})
);

5 ) Additional can create 2 API . 1st to Delete the blog post by user . 2nd Updating the blog post.

Additional Information

Hope you find issue to be good to solve

Attachments

image

@Adityajparmar37 Adityajparmar37 added the feature Adding new feature on top of the existing code label Jun 3, 2024
@Shivam2534
Copy link

Hello Sir,

My name is Shivam Kanchole, and I am a fourth-year student at IIT Roorkee. I find this issue both interesting and challenging. Additionally, I have worked on similar projects in the past. Could you please assign this issue to me?

Thank you.

Best regards,
Shivam Kanchole

@Adityajparmar37
Copy link
Contributor Author

@Shivam2534 do not wait for assign . If you known then do it ok

@krishnaacharyaa
Copy link
Owner

@Adityajparmar37 if you are still interested in working on this project, let me know via the project's discord, I might have some better issues of level 2 and 3 that you could work on !!

@Adityajparmar37
Copy link
Contributor Author

@krishnaacharyaa sounds great but the thing is currently my exam are going on hence i will not to able to give that much time.
And i does not want someone be waiting so sorry

@krishnaacharyaa
Copy link
Owner

No problem. Appreciate your senses @Adityajparmar37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new feature on top of the existing code
Projects
None yet
Development

No branches or pull requests

3 participants