Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion api/routes/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from ..models import Product, UpdationProduct
from ..services import ProductsServiceDependency, SecurityDependency
from ..__common_deps import QueryParamsDependency
from ..__common_deps import QueryParamsDependency, QueryParams

products_router = APIRouter(prefix="/products", tags=["Products"])

Expand Down Expand Up @@ -47,6 +47,14 @@ async def get_product(id: PydanticObjectId, products: ProductsServiceDependency)
)


@products_router.get("/get_by_seller/{id}")
async def get_products_by_seller_id(
id: PydanticObjectId, products: ProductsServiceDependency
):
params = QueryParams(filter=f"seller_id={id}")
return products.get_all_active(params)


@products_router.post("/", status_code=status.HTTP_201_CREATED)
async def create_product(
product: Product,
Expand Down