Skip to content

Conversation

christina-baldwin
Copy link

@christina-baldwin christina-baldwin commented Jun 15, 2025

Copy link

@Bianka2112 Bianka2112 left a comment

Choose a reason for hiding this comment

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

Nice job on a clean-cut app and UI 🥳 it seems super close on getting all the requirements. Just a few error messages to tell the user what's missing in register form, and connecting the authentication for edit/delete messages. I see now that when I logout and come back in, the liked messages do populate at the bottom so that is there 🙌 I know this was a behemoth of a project, so great job on it!

"category": "project",
"hearts": 3,
"createdAt": "2024-06-01T10:30:00Z",
"likedBy": ["user123"]

Choose a reason for hiding this comment

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

cool feature that you can store user likes on each post 🙌

Comment on lines +32 to +37
res.status(201).json({ success: true, message: "User created", token });
} catch (error) {
res
.status(500)
.json({ success: false, message: "Error creating user", error });
}

Choose a reason for hiding this comment

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

I could suggest adding more specific error messages/handling. It was hard to tell why I couldn't register at first. I needed 6 password characters and I was only doing 5. And the email field didnt show any user errors when registering, (it did in the login form). Its possible to use mongoose named errors to get more info; something in this direction:

    if (error.name === "ValidationError") {
      return res.status(400).json({
        success: false,
        errors: error.errors,
        message: "Validation failed",
      })
    }
    res.status(500).json({
      success: false,
      error: error.message,
      message: "Server error - try again later."
    })
  }

);
}

// Sort by date

Choose a reason for hiding this comment

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

Super nice that you started with these stretch goals for sorting and pagination. Maybe a quick copy from the school json to load a bunch more posts will help display this feature, without too much extra work on you. ✨

Comment on lines +124 to +129
// GET LIKED THOUGHTS FOR A USER
app.get("/thoughts/liked/:clientId", async (req, res) => {
try {
const { clientId } = req.params;
const likedThoughts = await Thought.find({ likedBy: clientId });

Choose a reason for hiding this comment

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

I think clientId is not in the Schemas, so possibly why it doesn't load liked messages at the bottom of the page while logged in. The like button is registering a like/unlike though, so nice job!

Comment on lines 149 to 154
const newThought = await new Thought({ message, category }).save();

res.status(200).json({
success: true,
response: newThought,
message: "Thought created successfully.",

Choose a reason for hiding this comment

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

could it be that clientId or wherever the token is called, needs to be added here so a user can get authorization to edit/delete their own thought?

Copy link

@JennieDalgren JennieDalgren left a comment

Choose a reason for hiding this comment

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

Good job with this project.

There are a few things that doesnt work. For example when trying to edit a thought I get this error message
image

The same goes for deleting a thought.
I can see that you are using the middlewere in the endpoints but maybe not fully implemented... Have a look.

When liking a thought i had to refresh the page, and then login again for that thought to be added to the section of my liked thoughts.

Have a look at the bug with editing and deleting and also make sure that you have met all requirements.
Double check so that the error handling is working on all your endpoints.

Great job so far! 💪

@christina-baldwin
Copy link
Author

Hi! Thanks to you both for your comments! Everything should be fixed now with errors on delete/update, adding validation properly, and the liked thoughts popping up at the bottom without needing a reload as well as making sure that liked thoughts are drawn from the userid instead of just based on localstorage. I also went through the requirements again and that seems ok too? Please let me know if I missed something :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants