Add product categorization feature - #40
Open
devin-ai-integration[bot] wants to merge 4 commits into
Open
devin-ai-integration[bot] wants to merge 4 commits into
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
- Created Category entity with id, name, and description fields - Added ManyToOne relationship between Product and Category - Implemented CategoryRepository, CategoryService, and CategoryController - Added category filtering endpoints to ProductController and ProductService - Updated DataInitializer to create sample categories and assign to products - Created frontend CategoryList component for viewing categories and filtering products - Updated Dashboard to display category statistics - Added Categories navigation link to Layout - Updated frontend API service with category endpoints - All backend tests passing Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Refactor CategoryController to use helper methods, reducing duplication from 7.86% to below 3% - Add CategoryServiceTest with 13 test cases covering all CRUD operations - Add CategoryControllerTest with 11 MockMvc test cases for REST endpoints - Add ProductServiceTest.testGetProductsByCategoryReturnsMatchingProducts - All 30 tests passing successfully - Addresses SonarQube quality gate failures for coverage and duplication Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
- Extract okOrNotFound helper method for Optional to ResponseEntity mapping - Reduces repeated .map(ResponseEntity::ok).orElse(ResponseEntity.notFound().build()) pattern - Addresses remaining SonarQube duplication issue (3.14% -> target <3%) Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
- Removes 8 duplicate lines that were matching Product.java pattern - No usage of Category.toString() found in codebase - Addresses SonarQube duplication issue (3.13% -> target <3%) - All 30 tests passing Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add product categorization feature
Summary
This PR adds comprehensive product categorization capabilities to the inventory management system, enabling better organization and filtering of products by category.
Backend changes:
Categoryentity with JPA annotations (id, name, description)ManyToOnerelationship fromProducttoCategory(nullable foreign key)/api/categoriesviaCategoryControllerCategoryServiceandCategoryRepositoryfollowing existing patternsProductControllerwith/api/products/category/{categoryId}endpoint for filteringDataInitializerto create 4 sample categories (Electronics, Computers, Audio, Wearables) and assign them to existing productsFrontend changes:
CategoryListcomponent with interactive category cards and product filteringDashboardto display total category count as a new stat card/categoriespath inApp.jsTesting:
Review & Testing Checklist for Human
Notes
categoriestable and acategory_idforeign key column to theproductstable. The relationship is nullable, so existing products without categories are supported.Session: https://app.devin.ai/sessions/04a702452ace48b1a011a37aa9da125e
Requested by: mason.batchelor@cognition.ai (@mbatchelor81)