diff --git a/server/polar/product/endpoints.py b/server/polar/product/endpoints.py index f699913a26..0b7273aa61 100644 --- a/server/polar/product/endpoints.py +++ b/server/polar/product/endpoints.py @@ -41,6 +41,9 @@ async def list( pagination: PaginationParamsQuery, sorting: ListSorting, auth_subject: auth.CreatorProductsRead, + id: MultipleQueryFilter[ProductID] | None = Query( + None, title="ProductID Filter", description="Filter by product ID." + ), organization_id: MultipleQueryFilter[OrganizationID] | None = Query( None, title="OrganizationID Filter", description="Filter by organization ID." ), @@ -65,6 +68,7 @@ async def list( results, count = await product_service.list( session, auth_subject, + id=id, organization_id=organization_id, query=query, is_archived=is_archived, diff --git a/server/polar/product/service/product.py b/server/polar/product/service/product.py index d868981727..9a78b7c5d7 100644 --- a/server/polar/product/service/product.py +++ b/server/polar/product/service/product.py @@ -62,6 +62,7 @@ async def list( session: AsyncSession, auth_subject: AuthSubject[User | Organization], *, + id: Sequence[uuid.UUID] | None = None, organization_id: Sequence[uuid.UUID] | None = None, query: str | None = None, is_archived: bool | None = None, @@ -91,6 +92,9 @@ async def list( isouter=True, ) + if id is not None: + statement = statement.where(Product.id.in_(id)) + if organization_id is not None: statement = statement.where(Product.organization_id.in_(organization_id))