Merge branch 'main' into storefront-nuxt

This commit is contained in:
Egor Pavlovich Gorbunov 2025-09-30 17:03:13 +03:00
commit ab35cb0c85
3 changed files with 1306 additions and 1188 deletions

View file

@ -378,72 +378,6 @@ PRODUCT_SCHEMA = {
description=_("(exact) Product UUID"), description=_("(exact) Product UUID"),
type=str, 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( OpenApiParameter(
name="order_by", name="order_by",
location="query", location="query",
@ -490,7 +424,7 @@ PRODUCT_SCHEMA = {
description=_("rewrite an existing product, preserving non-editable fields"), description=_("rewrite an existing product, preserving non-editable fields"),
parameters=[ parameters=[
OpenApiParameter( OpenApiParameter(
name="lookup", name="lookup_value",
location="path", location="path",
description=_("Product UUID or slug"), description=_("Product UUID or slug"),
type=str, type=str,
@ -506,7 +440,7 @@ PRODUCT_SCHEMA = {
description=_("update some fields of an existing product, preserving non-editable fields"), description=_("update some fields of an existing product, preserving non-editable fields"),
parameters=[ parameters=[
OpenApiParameter( OpenApiParameter(
name="lookup", name="lookup_value",
location="path", location="path",
description=_("Product UUID or slug"), description=_("Product UUID or slug"),
type=str, type=str,
@ -522,7 +456,7 @@ PRODUCT_SCHEMA = {
description=_("delete a product"), description=_("delete a product"),
parameters=[ parameters=[
OpenApiParameter( OpenApiParameter(
name="lookup", name="lookup_value",
location="path", location="path",
description=_("Product UUID or slug"), description=_("Product UUID or slug"),
type=str, type=str,
@ -538,14 +472,14 @@ PRODUCT_SCHEMA = {
description=_("lists all permitted feedbacks for a product"), description=_("lists all permitted feedbacks for a product"),
parameters=[ parameters=[
OpenApiParameter( OpenApiParameter(
name="lookup", name="lookup_value",
location="path", location="path",
description=_("Product UUID or slug"), description=_("Product UUID or slug"),
type=str, type=str,
), ),
], ],
responses={ responses={
status.HTTP_200_OK: FeedbackDetailSerializer(many=True), status.HTTP_200_OK: FeedbackSimpleSerializer(many=True),
**BASE_ERRORS, **BASE_ERRORS,
}, },
), ),
@ -554,7 +488,7 @@ PRODUCT_SCHEMA = {
description=_("returns a snapshot of the product's SEO meta data"), description=_("returns a snapshot of the product's SEO meta data"),
parameters=[ parameters=[
OpenApiParameter( OpenApiParameter(
name="lookup", name="lookup_value",
location="path", location="path",
description=_("Product UUID or slug"), description=_("Product UUID or slug"),
type=str, type=str,

View file

@ -533,6 +533,7 @@ class ProductViewSet(EvibesViewSet):
serializer_class = ProductDetailSerializer serializer_class = ProductDetailSerializer
action_serializer_classes = { action_serializer_classes = {
"list": ProductSimpleSerializer, "list": ProductSimpleSerializer,
"feedbacks": FeedbackSimpleSerializer,
} }
lookup_field = "lookup_value" lookup_field = "lookup_value"
lookup_url_kwarg = "lookup_value" lookup_url_kwarg = "lookup_value"
@ -584,7 +585,7 @@ class ProductViewSet(EvibesViewSet):
qs = Feedback.objects.filter(order_product__product=product) qs = Feedback.objects.filter(order_product__product=product)
if not request.user.has_perm("core.view_feedback"): if not request.user.has_perm("core.view_feedback"):
qs = qs.filter(is_active=True) qs = qs.filter(is_active=True)
return Response(data=FeedbackDetailSerializer(qs, many=True).data) return Response(data=FeedbackSimpleSerializer(qs, many=True).data)
@action( @action(
detail=True, detail=True,

2413
poetry.lock generated

File diff suppressed because it is too large Load diff