Skip to content

feat: low stock inventory endpoint#9

Closed
melinayg wants to merge 4 commits intomainfrom
feature/low-stock-inventory-endpoint
Closed

feat: low stock inventory endpoint#9
melinayg wants to merge 4 commits intomainfrom
feature/low-stock-inventory-endpoint

Conversation

@melinayg
Copy link
Copy Markdown
Collaborator

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:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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.

Copy link
Copy Markdown
Collaborator

@BeWelsh BeWelsh left a comment

Choose a reason for hiding this comment

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

@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!

@BeWelsh
Copy link
Copy Markdown
Collaborator

BeWelsh commented Jan 20, 2026

The bonus is spot on!

@BeWelsh BeWelsh closed this Feb 2, 2026
@BeWelsh BeWelsh deleted the feature/low-stock-inventory-endpoint branch February 3, 2026 15:21
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