Flask based API for nested Categories and Products hierarchy
- The Entities are a “Categories” and “Products”.
- Category can have multiple child categories.
- Child category can have further child categories.
- Category can have multiple products and product can have a multiple categories.
- The Entities will get saved in
MongoDB
and be retrieved viaPOST
andGET
Methods respectively.
Designed a proper Mongodb data model and APIs to
- Add a category
- Add Product mapped to a category or categories.
- Get all categories with all its child categories mapped to it. Note : Each category object should look something like this {Id : 1 , child_categories: [], ...}
- Get all products by a category.
- Update product details (
name
,price
, etc)