diff options
| author | alex <[email protected]> | 2026-07-17 18:16:35 +0200 |
|---|---|---|
| committer | alex <[email protected]> | 2026-07-17 18:16:35 +0200 |
| commit | 8e796c9cfcd65f6225a6ae3ec2a4419f265b0ebc (patch) | |
| tree | 1bf90385144be2e9f350c31da553b1ac306ee60b /inventory-service/app/api/v1 | |
| parent | 5f6918db393ed78dd8f038e9e5f1ea85f811dc52 (diff) | |
| download | order-inventory-system-main.tar.xz order-inventory-system-main.zip | |
Diffstat (limited to 'inventory-service/app/api/v1')
| -rw-r--r-- | inventory-service/app/api/v1/api.py | 9 | ||||
| -rw-r--r-- | inventory-service/app/api/v1/endpoints/products.py | 54 | ||||
| -rw-r--r-- | inventory-service/app/api/v1/endpoints/stock_movements.py | 47 |
3 files changed, 110 insertions, 0 deletions
diff --git a/inventory-service/app/api/v1/api.py b/inventory-service/app/api/v1/api.py new file mode 100644 index 0000000..b5d56d3 --- /dev/null +++ b/inventory-service/app/api/v1/api.py @@ -0,0 +1,9 @@ +from fastapi import APIRouter +from app.api.v1.endpoints import products, stock_movements + +api_router = APIRouter() + +api_router.include_router(products.router, prefix="/products", tags=["products"]) +api_router.include_router( + stock_movements.router, prefix="/stock-movements", tags=["stock-movements"] +) diff --git a/inventory-service/app/api/v1/endpoints/products.py b/inventory-service/app/api/v1/endpoints/products.py new file mode 100644 index 0000000..2e5a2b5 --- /dev/null +++ b/inventory-service/app/api/v1/endpoints/products.py @@ -0,0 +1,54 @@ +from fastapi import APIRouter, Depends, status +from sqlalchemy.orm import Session +from typing import List + +from app.api import deps +from app.schemas.inventory import ProductCreate, ProductUpdate, ProductOut + + +router = APIRouter() + + [email protected]("/", response_model=ProductOut, status_code=status.HTTP_201_CREATED) +def create_product(product_in: ProductCreate, db: Session = Depends(deps.get_db)): + """ + Register a new product with an initial stock level. + """ + pass # TODO: implement + + [email protected]("/", response_model=List[ProductOut]) +def list_products(skip: int = 0, limit: int = 100, db: Session = Depends(deps.get_db)): + """ + Return a paginated list of all products and their current stock levels. + """ + pass # TODO: implement + + [email protected]("/{product_id}", response_model=ProductOut) +def get_product(product_id: int, db: Session = Depends(deps.get_db)): + """ + Return a single product by its database ID. + """ + pass # TODO: implement + + [email protected]("/{product_id}", response_model=ProductOut) +def update_product( + product_id: int, + product_in: ProductUpdate, + db: Session = Depends(deps.get_db), +): + """ + Partially update a product (name or stock level). + Useful for manual stock adjustments by warehouse staff. + """ + pass # TODO: implement + + [email protected]("/{product_id}", status_code=status.HTTP_204_NO_CONTENT) +def delete_product(product_id: int, db: Session = Depends(deps.get_db)): + """ + Remove a product from the inventory. + """ + pass # TODO: implement diff --git a/inventory-service/app/api/v1/endpoints/stock_movements.py b/inventory-service/app/api/v1/endpoints/stock_movements.py new file mode 100644 index 0000000..f70396f --- /dev/null +++ b/inventory-service/app/api/v1/endpoints/stock_movements.py @@ -0,0 +1,47 @@ +from fastapi import APIRouter, Depends, status +from sqlalchemy.orm import Session +from typing import List + +from app.api import deps +from app.schemas.inventory import StockMovementOut + + +router = APIRouter() + + [email protected]("/", response_model=List[StockMovementOut]) +def list_stock_movements( + skip: int = 0, + limit: int = 100, + db: Session = Depends(deps.get_db), +): + """ + Return a paginated list of all stock movements across all products. + Useful for auditing the full history of reservations and releases. + """ + pass # TODO: implement + + [email protected]("/product/{product_id}", response_model=List[StockMovementOut]) +def list_movements_for_product( + product_id: int, + skip: int = 0, + limit: int = 100, + db: Session = Depends(deps.get_db), +): + """ + Return all stock movements for a specific product. + """ + pass # TODO: implement + + [email protected]("/order/{order_id}", response_model=List[StockMovementOut]) +def list_movements_for_order( + order_id: int, + db: Session = Depends(deps.get_db), +): + """ + Return all stock movements associated with a specific order. + Lets you see exactly what was reserved/released for a given order. + """ + pass # TODO: implement |
