Features: 1) Add "feedbacks" action with corresponding serializer in ProductViewSet;
Fixes: 1) Replace `lookup` with `lookup_value` in API parameter definitions; Extra: 1) Remove unused query parameters for product listing documentation.
This commit is contained in:
parent
e0c26efa5d
commit
e18327b920
2 changed files with 5 additions and 70 deletions
|
|
@ -378,72 +378,6 @@ PRODUCT_SCHEMA = {
|
|||
description=_("(exact) Product UUID"),
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="name",
|
||||
location="query",
|
||||
description=_("(icontains) Product name"),
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="categories",
|
||||
location="query",
|
||||
description=_("(list) Category names, case-insensitive"),
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="category_uuid",
|
||||
location="query",
|
||||
description=_("(exact) Category UUID"),
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="tags",
|
||||
location="query",
|
||||
description=_("(list) Tag names, case-insensitive"),
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="min_price",
|
||||
location="query",
|
||||
description=_("(gte) Minimum stock price"),
|
||||
type=float,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="max_price",
|
||||
location="query",
|
||||
description=_("(lte) Maximum stock price"),
|
||||
type=float,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="is_active",
|
||||
location="query",
|
||||
description=_("(exact) Only active products"),
|
||||
type=bool,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="brand",
|
||||
location="query",
|
||||
description=_("(iexact) Brand name"),
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="attributes",
|
||||
location="query",
|
||||
description=ATTRIBUTES_DESC,
|
||||
type=str,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="quantity",
|
||||
location="query",
|
||||
description=_("(gt) Minimum stock quantity"),
|
||||
type=int,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="is_digital",
|
||||
location="query",
|
||||
description=_("(exact) Digital vs. physical"),
|
||||
type=bool,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="order_by",
|
||||
location="query",
|
||||
|
|
@ -490,7 +424,7 @@ PRODUCT_SCHEMA = {
|
|||
description=_("rewrite an existing product, preserving non-editable fields"),
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="lookup",
|
||||
name="lookup_value",
|
||||
location="path",
|
||||
description=_("Product UUID or slug"),
|
||||
type=str,
|
||||
|
|
@ -506,7 +440,7 @@ PRODUCT_SCHEMA = {
|
|||
description=_("update some fields of an existing product, preserving non-editable fields"),
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="lookup",
|
||||
name="lookup_value",
|
||||
location="path",
|
||||
description=_("Product UUID or slug"),
|
||||
type=str,
|
||||
|
|
@ -522,7 +456,7 @@ PRODUCT_SCHEMA = {
|
|||
description=_("delete a product"),
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="lookup",
|
||||
name="lookup_value",
|
||||
location="path",
|
||||
description=_("Product UUID or slug"),
|
||||
type=str,
|
||||
|
|
@ -538,7 +472,7 @@ PRODUCT_SCHEMA = {
|
|||
description=_("lists all permitted feedbacks for a product"),
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="lookup",
|
||||
name="lookup_value",
|
||||
location="path",
|
||||
description=_("Product UUID or slug"),
|
||||
type=str,
|
||||
|
|
|
|||
|
|
@ -533,6 +533,7 @@ class ProductViewSet(EvibesViewSet):
|
|||
serializer_class = ProductDetailSerializer
|
||||
action_serializer_classes = {
|
||||
"list": ProductSimpleSerializer,
|
||||
"feedbacks": FeedbackSimpleSerializer,
|
||||
}
|
||||
lookup_field = "lookup_value"
|
||||
lookup_url_kwarg = "lookup_value"
|
||||
|
|
|
|||
Loading…
Reference in a new issue