Skip to content

Happy Thoughts API by Joyce Kuo#511

Open
JoyceKuode wants to merge 6 commits intoTechnigo:masterfrom
JoyceKuode:master
Open

Happy Thoughts API by Joyce Kuo#511
JoyceKuode wants to merge 6 commits intoTechnigo:masterfrom
JoyceKuode:master

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 ! 😊

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.

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