feat: proposal approach backend + db#511
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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:
- Create a Category Model: You need to create a new file,
src/models/Category.model.js, to define theCategoryentity. - Update the Expense Model: In
src/models/Expense.model.js, thecategoryfield should be changed from aSTRINGto a foreign key that references the newCategorymodel. - Implement API Endpoints: The CRUD routes for categories (e.g.,
GET /categories,POST /categories, etc.) are missing fromsrc/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
| category: { | ||
| type: DataTypes.STRING, | ||
| allowNull: true, | ||
| }, |
There was a problem hiding this comment.
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.
|
|
||
| res.status(204).send(); | ||
| }); | ||
|
|
There was a problem hiding this comment.
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.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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! ✨
Description