ecommerce1-xk8uuj/endpoints/products.post.py
2025-03-30 08:33:40 +01:00

10 lines
337 B
Python

from fastapi import APIRouter, Depends, status
from schemas.product import ProductCreate
from helpers.product_helpers import create_product
router = APIRouter()
@router.post("/products", status_code=status.HTTP_201_CREATED)
async def add_product(product: ProductCreate):
new_product = create_product(product)
return new_product