Skip to content

add task solution#120

Open
DmutroSheva wants to merge 1 commit into
mate-academy:masterfrom
DmutroSheva:develop
Open

add task solution#120
DmutroSheva wants to merge 1 commit into
mate-academy:masterfrom
DmutroSheva:develop

Conversation

@DmutroSheva
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job! 🎉 Your server-side implementation meets all core requirements and is well-structured. The only minor issue is the use of HTTP 404 instead of 400 for input validation errors—this doesn't affect functionality, but keep REST conventions in mind for future projects. Keep up the good work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

const { text, userId } = req.body;

if (!roomId || !userId || !text) {
return res.sendStatus(404);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue: Returning status 404 for missing parameters is not correct. According to REST conventions, 404 is for 'Not Found' (i.e., resource does not exist), not for missing or invalid input. You should return status 400 (Bad Request) instead.

const { title, userId, description } = req.body;

if (!title || !userId) {
return res.sendStatus(404);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue: Returning status 404 for missing 'title' or 'userId' is not correct. According to REST conventions, 404 is for 'Not Found' resources, not for invalid or missing input. Use status 400 (Bad Request) instead.

const { title, description } = req.body;

if ((!title && !description) || !roomId) {
return res.sendStatus(404);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue: Returning status 404 for missing 'roomId' or both 'title' and 'description' is not correct. 404 is for missing resources, not invalid input. Use status 400 (Bad Request) for input validation errors.

const isNameExist = await User.findOne({ where: { name } });

if (!name) {
return res.sendStatus(404);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue: Returning status 404 for missing 'name' is not correct. 404 is for 'Not Found' resources, not for invalid or missing input. Use status 400 (Bad Request) instead.

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