krishnaacharyaa / wanderlust

WanderLust is a MERN travel blog website 🚀 This project is aimed to help people to contribute in open source, upskill in react and master git.
https://wanderlust-beta.vercel.app/
MIT License
174 stars 826 forks source link

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

Open Adityajparmar37 opened 4 weeks ago

Adityajparmar37 commented 4 weeks ago

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

Shivam2534 commented 2 weeks ago

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 commented 2 weeks ago

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

krishnaacharyaa commented 2 weeks ago

@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 commented 1 week ago

@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 commented 1 week ago

No problem. Appreciate your senses @Adityajparmar37