Repository navigation
Add ingredient API endpoints - #53
Conversation
…ry, request/response records Created IngredientController - handles HTTP requests from client - GET /api/v1/ingredients - POST /api/v1/ingredients Created IngredientCreate - represents data needed to create an ingredient Created Ingredient Response - represents the data sent back to the client - converts an Ingredient database entity into safe API output Created IngredientService.java - handles pagination - checks duplicate names - creates/saves ingredients - converts entities into reponse objects
Solian21
left a comment
There was a problem hiding this comment.
This code is really well done. It’s clearly structured and uses DTOs effectively. I specifically like how the responsibilities are separated cleanly across the controller, service, repository, and test layers.
There was a problem hiding this comment.
Honestly I think this code looks pretty good, though if you want to meet the test coverage requirements you could use tests for IngredientController and IngredientService that you haven't covered yet.
Running the tests using coverage can help, but I believe list and create in service are missing tests, as well as listingredients and createingredients in controller. Running ./gradlew check can also help. You probably don't have to make tests for all of those methods, but I think some quick controller tests could be useful and full coverage is good.
Also when you have the chance, you'll need to add javadoc comments
- ingredient updated so it stores the original name and a normalized lowercase - changed IngredientService to use saveAndFlush() and the exception returns a 409
… lesly/ingredients_API
…e requiring authentication to create ingredients
annabelleb20
left a comment
There was a problem hiding this comment.
I think this is overall great work!
Closes #51
What changed
GET /api/v1/ingredientsfor paginated ingredient browsing.POST /api/v1/ingredientsfor creating ingredients.IngredientController,IngredientService, andIngredientRepository.IngredientCreateandIngredientResponserecords.How I tested it
./gradlew testlocally.