Closed
Conversation
BeWelsh
requested changes
Jan 20, 2026
Collaborator
There was a problem hiding this comment.
@melinayg Looks good - the only thing I would change is using a pydantic model for the router response. Currently a List[dict] is being returned, but since we know the data we will be receiving from the check_low_stock function, it would be good practice to create a pydantic model representing the data in the dict.
Also, your changes from the first task came into this PR - in the future, it will be best to have each branch created off main (assuming you will be merging to main). So each feature is isolated before merging. If you have any questions about this, feel free to reach out!
Well done!
Collaborator
|
The bonus is spot on! |
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.
Description
What does this PR do?
Added an endpoint that checks which chocolates are low on inventory and notifies shopkeepers. It returns all low-stock items below specified threshold.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Already using the existing test_check_low_stock test to verify that low-stock detection works.
Checklist:
Bonus Task
If we want the option to specify how the returned list of chocolates will be sorted, I would first add a sort_by parameter to the router to the get_chocolates endpoint, and raise error if any invalid inputs (not price, cocoa %, stock). Then, I would change the get_chocolates() method in the service layer to accept the sort_by and change the hardcoded sort with the parameter input.