Skip to content

feat: proposal approach backend + db#511

Open
ht1204 wants to merge 2 commits intomate-academy:masterfrom
ht1204:develop
Open

feat: proposal approach backend + db#511
ht1204 wants to merge 2 commits intomate-academy:masterfrom
ht1204:develop

Conversation

@ht1204
Copy link
Copy Markdown

@ht1204 ht1204 commented Apr 5, 2026

Description

  • Proposal approach for backend + postgres db

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

This submission requires changes because the primary requirement of the task—implementing full CRUD functionality for categories—has not been addressed. The existing setup for users and expenses is a great start, but the core feature for this assignment is missing.

To meet the requirements, please focus on the following:

  1. Create a Category Model: You need to create a new file, src/models/Category.model.js, to define the Category entity.
  2. Update the Expense Model: In src/models/Expense.model.js, the category field should be changed from a STRING to a foreign key that references the new Category model.
  3. Implement API Endpoints: The CRUD routes for categories (e.g., GET /categories, POST /categories, etc.) are missing from src/createServer.js.

You're on the right track, and once this functionality is added, your project will be complete!


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/models/Expense.model.js Outdated
Comment on lines +26 to +29
category: {
type: DataTypes.STRING,
allowNull: true,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To properly manage categories with CRUD operations as required, Category should be a separate database entity (model). Therefore, this category field should be a foreign key (e.g., categoryId) referencing the new Category model, not a STRING type. You'll need to create a Category.model.js and set up the association between Expense and Category.

Comment thread src/createServer.js

res.status(204).send();
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The core requirement is to add CRUD endpoints for managing categories. The implementation for these routes (e.g., app.get('/categories', ...), app.post('/categories', ...), etc.) is missing.

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

Excellent work on this pull request! I am approving your submission as you've successfully addressed all the feedback from the previous review and fully implemented the required CRUD functionality for categories. The new Category model is well-defined, the Expense model is correctly updated with a foreign key, and the associations between them are set up perfectly. All the new API endpoints are working as expected, and the updated tests ensure the changes are robust. The code is clean, well-structured, and meets all task requirements. Keep up the great work!


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

Footnotes

  1. Rate AI review example

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