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

Happy Thoughts API by Joyce Kuo #511

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JoyceKuode
Copy link

@HIPPIEKICK HIPPIEKICK self-assigned this Jan 9, 2025
Copy link
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

Well done 💯

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice that you broke out the model 👍 Can be nice for the final project as well, when your project will be bigger

Comment on lines +55 to +69
const newThought = await new Thought({ message }).save();

// Send success response with saved thought
res.status(201).json({
success: true,
response: newThought,
message: "Thought was successfully created!",
});
} catch (error) {
res.status(400).json({
success: false,
response: error.message,
message: "Failed to create thought",
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice structure 😉

Comment on lines +78 to +82
const updatedThought = await Thought.findByIdAndUpdate(
thoughtId,
{ $inc: { hearts: 1 } }, // Increment the hearts field by 1
{ new: true } // Return the update
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

Can you please change the fetch URL in your frontend 😇

@JoyceKuode
Copy link
Author

Fetch URL should now be updated. Thank you ! 😊

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.

2 participants