fix(mutations): require wishlist_uuid in mutations to ensure data integrity
Made `wishlist_uuid` a required argument to avoid processing without a valid identifier. Prevents potential errors caused by missing wishlist references.
This commit is contained in:
parent
dc94841f40
commit
a5a9c70080
1 changed files with 2 additions and 4 deletions
|
|
@ -312,7 +312,7 @@ class BulkWishlistAction(Mutation):
|
||||||
description = _("perform an action on a list of products in the wishlist")
|
description = _("perform an action on a list of products in the wishlist")
|
||||||
|
|
||||||
class Arguments:
|
class Arguments:
|
||||||
wishlist_uuid = UUID(required=False)
|
wishlist_uuid = UUID(required=True)
|
||||||
action = String(required=True, description="remove/add")
|
action = String(required=True, description="remove/add")
|
||||||
products = List(BulkProductInput, required=True)
|
products = List(BulkProductInput, required=True)
|
||||||
|
|
||||||
|
|
@ -324,10 +324,8 @@ class BulkWishlistAction(Mutation):
|
||||||
info,
|
info,
|
||||||
action,
|
action,
|
||||||
products,
|
products,
|
||||||
wishlist_uuid=None,
|
wishlist_uuid,
|
||||||
):
|
):
|
||||||
if not wishlist_uuid:
|
|
||||||
raise BadRequest(_("please provide wishlist_uuid value"))
|
|
||||||
user = info.context.user
|
user = info.context.user
|
||||||
try:
|
try:
|
||||||
wishlist = Wishlist.objects.get(user=user, uuid=wishlist_uuid)
|
wishlist = Wishlist.objects.get(user=user, uuid=wishlist_uuid)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue