Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

[SD-1467] - Add Platform API For Wishlists (#11355)

Matthew Kennedya4f6dea47791
diff --git a/api/app/controllers/spree/api/v2/platform/wished_items_controller.rb b/api/app/controllers/spree/api/v2/platform/wished_items_controller.rb
new file mode 100644
index 0000000000..24c9ffdc9f
--- /dev/null
+++ b/api/app/controllers/spree/api/v2/platform/wished_items_controller.rb
@@ -0,0 +1,23 @@
+module Spree
+ module Api
+ module V2
+ module Platform
+ class WishedItemsController < ResourceController
+ private
+
+ def scope_includes
+ [:variant]
+ end
+
+ def model_class
+ Spree::WishedItem
+ end
+
+ def permitted_resource_params
+ params.require(model_param_name).permit(spree_permitted_attributes << :wishlist_id)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/api/app/controllers/spree/api/v2/platform/wishlists_controller.rb b/api/app/controllers/spree/api/v2/platform/wishlists_controller.rb
new file mode 100644
index 0000000000..44223baae9
--- /dev/null
+++ b/api/app/controllers/spree/api/v2/platform/wishlists_controller.rb
@@ -0,0 +1,23 @@
+module Spree
+ module Api
+ module V2
+ module Platform
+ class WishlistsController < ResourceController
+ private
+
+ def model_class
+ Spree::Wishlist
+ end
+
+ def scope_includes
+ [:wished_items]
+ end
+
+ def permitted_resource_params
+ params.require(model_param_name).permit(spree_permitted_attributes << :user_id)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/api/app/serializers/spree/api/v2/platform/wished_item_serializer.rb b/api/app/serializers/spree/api/v2/platform/wished_item_serializer.rb
new file mode 100644
index 0000000000..d3b8f8c6b5
--- /dev/null
+++ b/api/app/serializers/spree/api/v2/platform/wished_item_serializer.rb
@@ -0,0 +1,29 @@
+module Spree
+ module Api
+ module V2
+ module Platform
+ class WishedItemSerializer < BaseSerializer
+ include ::Spree::Api::V2::ResourceSerializerConcern
+
+ attribute :price do |wished_item, params|
+ wished_item.price(currency: params[:currency])
+ end
+
+ attribute :total do |wished_item, params|
+ wished_item.total(currency: params[:currency])
+ end
+
+ attribute :display_price do |wished_item, params|
+ wished_item.display_price(currency: params[:currency]).to_s
+ end
+
+ attribute :display_total do |wished_item, params|
+ wished_item.display_total(currency: params[:currency]).to_s
+ end
+
+ belongs_to :variant
+ end
+ end
+ end
+ end
+end
diff --git a/api/app/serializers/spree/api/v2/platform/wishlist_serializer.rb b/api/app/serializers/spree/api/v2/platform/wishlist_serializer.rb
new file mode 100644
index 0000000000..61365fe3d2
--- /dev/null
+++ b/api/app/serializers/spree/api/v2/platform/wishlist_serializer.rb
@@ -0,0 +1,19 @@
+module Spree
+ module Api
+ module V2
+ module Platform
+ class WishlistSerializer < BaseSerializer
+ include ::Spree::Api::V2::ResourceSerializerConcern
+
+ attributes :token
+
+ attribute :variant_included do |wishlist, params|
+ wishlist.include?(params[:is_variant_included])
+ end
+
+ has_many :wished_items
+ end
+ end
+ end
+ end
+end
diff --git a/api/config/routes.rb b/api/config/routes.rb
index e9e19eed5a..474b730226 100644
--- a/api/config/routes.rb
+++ b/api/config/routes.rb
@@ -285,6 +285,10 @@ Spree::Core::Engine.add_routes do
end
end
+ # Wishlists
+ resources :wishlists
+ resources :wished_items
+
# Store API
resources :stores
end
diff --git a/api/docs/v2/platform/index.yaml b/api/docs/v2/platform/index.yaml
index e294e69b14..1c48256355 100644
--- a/api/docs/v2/platform/index.yaml
+++ b/api/docs/v2/platform/index.yaml
@@ -63,8 +63,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-30T22:29:07.024Z'
- updated_at: '2021-08-30T22:29:07.024Z'
+ created_at: '2021-09-21T20:47:27.913Z'
+ updated_at: '2021-09-21T20:47:27.913Z'
deleted_at:
label:
relationships:
@@ -91,8 +91,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-30T22:29:07.026Z'
- updated_at: '2021-08-30T22:29:07.026Z'
+ created_at: '2021-09-21T20:47:27.915Z'
+ updated_at: '2021-09-21T20:47:27.915Z'
deleted_at:
label:
relationships:
@@ -162,8 +162,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-30T22:29:07.137Z'
- updated_at: '2021-08-30T22:29:07.137Z'
+ created_at: '2021-09-21T20:47:28.023Z'
+ updated_at: '2021-09-21T20:47:28.023Z'
deleted_at:
label:
relationships:
@@ -253,8 +253,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-30T22:29:07.160Z'
- updated_at: '2021-08-30T22:29:07.160Z'
+ created_at: '2021-09-21T20:47:28.044Z'
+ updated_at: '2021-09-21T20:47:28.044Z'
deleted_at:
label:
relationships:
@@ -327,8 +327,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-08-30T22:29:07.192Z'
- updated_at: '2021-08-30T22:29:07.196Z'
+ created_at: '2021-09-21T20:47:28.083Z'
+ updated_at: '2021-09-21T20:47:28.089Z'
deleted_at:
label:
relationships:
@@ -455,8 +455,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-30T22:29:07.400Z'
- updated_at: '2021-08-30T22:29:07.400Z'
+ created_at: '2021-09-21T20:47:28.323Z'
+ updated_at: '2021-09-21T20:47:28.323Z'
relationships:
product:
data:
@@ -470,8 +470,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-30T22:29:07.447Z'
- updated_at: '2021-08-30T22:29:07.447Z'
+ created_at: '2021-09-21T20:47:28.404Z'
+ updated_at: '2021-09-21T20:47:28.404Z'
relationships:
product:
data:
@@ -528,8 +528,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-30T22:29:07.600Z'
- updated_at: '2021-08-30T22:29:07.600Z'
+ created_at: '2021-09-21T20:47:28.653Z'
+ updated_at: '2021-09-21T20:47:28.653Z'
relationships:
product:
data:
@@ -592,8 +592,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-30T22:29:07.667Z'
- updated_at: '2021-08-30T22:29:07.667Z'
+ created_at: '2021-09-21T20:47:28.756Z'
+ updated_at: '2021-09-21T20:47:28.756Z'
relationships:
product:
data:
@@ -653,8 +653,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-08-30T22:29:07.783Z'
- updated_at: '2021-08-30T22:29:07.783Z'
+ created_at: '2021-09-21T20:47:28.939Z'
+ updated_at: '2021-09-21T20:47:28.939Z'
relationships:
product:
data:
@@ -764,8 +764,8 @@ paths:
type: classification
attributes:
position: 2
- created_at: '2021-08-30T22:29:08.086Z'
- updated_at: '2021-08-30T22:29:08.095Z'
+ created_at: '2021-09-21T20:47:29.407Z'
+ updated_at: '2021-09-21T20:47:29.417Z'
relationships:
product:
data:
@@ -832,9 +832,9 @@ paths:
name: United States of America
numcode: 840
states_required: true
- updated_at: '2021-08-30T22:29:08.218Z'
+ updated_at: '2021-09-21T20:47:29.609Z'
zipcode_required: true
- created_at: '2021-08-30T22:29:08.218Z'
+ created_at: '2021-09-21T20:47:29.609Z'
relationships:
states:
data: []
@@ -847,9 +847,9 @@ paths:
name: NAME_2
numcode: 840
states_required: false
- updated_at: '2021-08-30T22:29:08.222Z'
+ updated_at: '2021-09-21T20:47:29.613Z'
zipcode_required: true
- created_at: '2021-08-30T22:29:08.222Z'
+ created_at: '2021-09-21T20:47:29.613Z'
relationships:
states:
data: []
@@ -862,9 +862,9 @@ paths:
name: NAME_3
numcode: 840
states_required: false
- updated_at: '2021-08-30T22:29:08.223Z'
+ updated_at: '2021-09-21T20:47:29.613Z'
zipcode_required: true
- created_at: '2021-08-30T22:29:08.223Z'
+ created_at: '2021-09-21T20:47:29.613Z'
relationships:
states:
data: []
@@ -919,9 +919,9 @@ paths:
name: NAME_6
numcode: 840
states_required: false
- updated_at: '2021-08-30T22:29:08.259Z'
+ updated_at: '2021-09-21T20:47:29.642Z'
zipcode_required: true
- created_at: '2021-08-30T22:29:08.259Z'
+ created_at: '2021-09-21T20:47:29.642Z'
relationships:
states:
data: []
@@ -986,7 +986,7 @@ paths:
- id: '1'
type: menu_item
attributes:
- name: Corporis deleniti vel necessitatibus laborum aliquid.
+ name: Possimus deserunt similique asperiores eveniet.
subtitle:
destination:
new_window: false
@@ -996,8 +996,8 @@ paths:
lft: 1
rgt: 16
depth: 0
- created_at: '2021-08-30T22:29:08.302Z'
- updated_at: '2021-08-30T22:29:08.383Z'
+ created_at: '2021-09-21T20:47:29.680Z'
+ updated_at: '2021-09-21T20:47:29.972Z'
link:
is_container: true
is_root: true
@@ -1043,8 +1043,8 @@ paths:
lft: 2
rgt: 3
depth: 1
- created_at: '2021-08-30T22:29:08.314Z'
- updated_at: '2021-08-30T22:29:08.316Z'
+ created_at: '2021-09-21T20:47:29.721Z'
+ updated_at: '2021-09-21T20:47:29.724Z'
link:
is_container: false
is_root: false
@@ -1080,8 +1080,8 @@ paths:
lft: 4
rgt: 5
depth: 1
- created_at: '2021-08-30T22:29:08.325Z'
- updated_at: '2021-08-30T22:29:08.327Z'
+ created_at: '2021-09-21T20:47:29.761Z'
+ updated_at: '2021-09-21T20:47:29.764Z'
link:
is_container: false
is_root: false
@@ -1117,8 +1117,8 @@ paths:
lft: 6
rgt: 7
depth: 1
- created_at: '2021-08-30T22:29:08.336Z'
- updated_at: '2021-08-30T22:29:08.337Z'
+ created_at: '2021-09-21T20:47:29.800Z'
+ updated_at: '2021-09-21T20:47:29.802Z'
link:
is_container: false
is_root: false
@@ -1154,8 +1154,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-08-30T22:29:08.346Z'
- updated_at: '2021-08-30T22:29:08.348Z'
+ created_at: '2021-09-21T20:47:29.838Z'
+ updated_at: '2021-09-21T20:47:29.840Z'
link:
is_container: false
is_root: false
@@ -1191,8 +1191,8 @@ paths:
lft: 10
rgt: 11
depth: 1
- created_at: '2021-08-30T22:29:08.356Z'
- updated_at: '2021-08-30T22:29:08.358Z'
+ created_at: '2021-09-21T20:47:29.877Z'
+ updated_at: '2021-09-21T20:47:29.880Z'
link:
is_container: false
is_root: false
@@ -1228,8 +1228,8 @@ paths:
lft: 12
rgt: 13
depth: 1
- created_at: '2021-08-30T22:29:08.367Z'
- updated_at: '2021-08-30T22:29:08.369Z'
+ created_at: '2021-09-21T20:47:29.917Z'
+ updated_at: '2021-09-21T20:47:29.920Z'
link:
is_container: false
is_root: false
@@ -1265,8 +1265,8 @@ paths:
lft: 14
rgt: 15
depth: 1
- created_at: '2021-08-30T22:29:08.377Z'
- updated_at: '2021-08-30T22:29:08.379Z'
+ created_at: '2021-09-21T20:47:29.957Z'
+ updated_at: '2021-09-21T20:47:29.959Z'
link:
is_container: false
is_root: false
@@ -1345,8 +1345,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-08-30T22:29:08.554Z'
- updated_at: '2021-08-30T22:29:08.556Z'
+ created_at: '2021-09-21T20:47:30.427Z'
+ updated_at: '2021-09-21T20:47:30.429Z'
link:
is_container: false
is_root: false
@@ -1432,8 +1432,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-08-30T22:29:08.665Z'
- updated_at: '2021-08-30T22:29:08.667Z'
+ created_at: '2021-09-21T20:47:30.745Z'
+ updated_at: '2021-09-21T20:47:30.748Z'
link:
is_container: false
is_root: false
@@ -1515,8 +1515,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-08-30T22:29:08.831Z'
- updated_at: '2021-08-30T22:29:08.843Z'
+ created_at: '2021-09-21T20:47:31.244Z'
+ updated_at: '2021-09-21T20:47:31.257Z'
link:
is_container: false
is_root: false
@@ -1641,8 +1641,8 @@ paths:
lft: 5
rgt: 6
depth: 2
- created_at: '2021-08-30T22:29:09.230Z'
- updated_at: '2021-08-30T22:29:09.241Z'
+ created_at: '2021-09-21T20:47:32.441Z'
+ updated_at: '2021-09-21T20:47:32.456Z'
link:
is_container: false
is_root: false
@@ -1734,8 +1734,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-08-30T22:29:09.361Z'
- updated_at: '2021-08-30T22:29:09.390Z'
+ created_at: '2021-09-21T20:47:32.789Z'
+ updated_at: '2021-09-21T20:47:32.878Z'
relationships:
menu_items:
data:
@@ -1751,8 +1751,8 @@ paths:
name: Footer Menu
location: footer
locale: en
- created_at: '2021-08-30T22:29:09.365Z'
- updated_at: '2021-08-30T22:29:09.411Z'
+ created_at: '2021-09-21T20:47:32.794Z'
+ updated_at: '2021-09-21T20:47:32.961Z'
relationships:
menu_items:
data:
@@ -1811,8 +1811,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-08-30T22:29:09.492Z'
- updated_at: '2021-08-30T22:29:09.495Z'
+ created_at: '2021-09-21T20:47:33.175Z'
+ updated_at: '2021-09-21T20:47:33.179Z'
relationships:
menu_items:
data:
@@ -1876,8 +1876,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-08-30T22:29:09.523Z'
- updated_at: '2021-08-30T22:29:09.527Z'
+ created_at: '2021-09-21T20:47:33.200Z'
+ updated_at: '2021-09-21T20:47:33.203Z'
relationships:
menu_items:
data:
@@ -1935,8 +1935,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-08-30T22:29:09.565Z'
- updated_at: '2021-08-30T22:29:09.568Z'
+ created_at: '2021-09-21T20:47:33.239Z'
+ updated_at: '2021-09-21T20:47:33.242Z'
relationships:
menu_items:
data:
@@ -2060,8 +2060,8 @@ paths:
name: foo-size-1
presentation: Size
position: 1
- created_at: '2021-08-30T22:29:09.672Z'
- updated_at: '2021-08-30T22:29:09.672Z'
+ created_at: '2021-09-21T20:47:33.339Z'
+ updated_at: '2021-09-21T20:47:33.339Z'
filterable: true
relationships:
option_values:
@@ -2072,8 +2072,8 @@ paths:
name: foo-size-2
presentation: Size
position: 2
- created_at: '2021-08-30T22:29:09.673Z'
- updated_at: '2021-08-30T22:29:09.673Z'
+ created_at: '2021-09-21T20:47:33.340Z'
+ updated_at: '2021-09-21T20:47:33.340Z'
filterable: true
relationships:
option_values:
@@ -2127,8 +2127,8 @@ paths:
name: foo-size-5
presentation: Size
position: 1
- created_at: '2021-08-30T22:29:09.706Z'
- updated_at: '2021-08-30T22:29:09.706Z'
+ created_at: '2021-09-21T20:47:33.369Z'
+ updated_at: '2021-09-21T20:47:33.369Z'
filterable: true
relationships:
option_values:
@@ -2188,8 +2188,8 @@ paths:
name: foo-size-6
presentation: Size
position: 1
- created_at: '2021-08-30T22:29:09.726Z'
- updated_at: '2021-08-30T22:29:09.726Z'
+ created_at: '2021-09-21T20:47:33.387Z'
+ updated_at: '2021-09-21T20:47:33.387Z'
filterable: true
relationships:
option_values:
@@ -2246,8 +2246,8 @@ paths:
name: Size-X
presentation: Size
position: 1
- created_at: '2021-08-30T22:29:09.758Z'
- updated_at: '2021-08-30T22:29:09.762Z'
+ created_at: '2021-09-21T20:47:33.421Z'
+ updated_at: '2021-09-21T20:47:33.425Z'
filterable: true
relationships:
option_values:
@@ -2365,8 +2365,8 @@ paths:
position: 1
name: Size-1
presentation: S
- created_at: '2021-08-30T22:29:09.842Z'
- updated_at: '2021-08-30T22:29:09.842Z'
+ created_at: '2021-09-21T20:47:33.493Z'
+ updated_at: '2021-09-21T20:47:33.493Z'
relationships:
option_type:
data:
@@ -2378,8 +2378,8 @@ paths:
position: 1
name: Size-2
presentation: S
- created_at: '2021-08-30T22:29:09.845Z'
- updated_at: '2021-08-30T22:29:09.845Z'
+ created_at: '2021-09-21T20:47:33.496Z'
+ updated_at: '2021-09-21T20:47:33.496Z'
relationships:
option_type:
data:
@@ -2434,8 +2434,8 @@ paths:
position: 1
name: Size-5
presentation: S
- created_at: '2021-08-30T22:29:09.880Z'
- updated_at: '2021-08-30T22:29:09.880Z'
+ created_at: '2021-09-21T20:47:33.595Z'
+ updated_at: '2021-09-21T20:47:33.595Z'
relationships:
option_type:
data:
@@ -2494,8 +2494,8 @@ paths:
position: 1
name: Size-6
presentation: S
- created_at: '2021-08-30T22:29:09.906Z'
- updated_at: '2021-08-30T22:29:09.906Z'
+ created_at: '2021-09-21T20:47:33.616Z'
+ updated_at: '2021-09-21T20:47:33.616Z'
relationships:
option_type:
data:
@@ -2553,8 +2553,8 @@ paths:
position: 1
name: M
presentation: S
- created_at: '2021-08-30T22:29:09.941Z'
- updated_at: '2021-08-30T22:29:09.946Z'
+ created_at: '2021-09-21T20:47:33.647Z'
+ updated_at: '2021-09-21T20:47:33.652Z'
relationships:
option_type:
data:
@@ -2676,8 +2676,8 @@ paths:
lft: 1
rgt: 6
description:
- created_at: '2021-08-30T22:29:10.032Z'
- updated_at: '2021-08-30T22:29:10.059Z'
+ created_at: '2021-09-21T20:47:33.731Z'
+ updated_at: '2021-09-21T20:47:33.825Z'
meta_title:
meta_description:
meta_keywords:
@@ -2711,8 +2711,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-08-30T22:29:10.043Z'
- updated_at: '2021-08-30T22:29:10.044Z'
+ created_at: '2021-09-21T20:47:33.777Z'
+ updated_at: '2021-09-21T20:47:33.779Z'
meta_title:
meta_description:
meta_keywords:
@@ -2746,8 +2746,8 @@ paths:
lft: 4
rgt: 5
description:
- created_at: '2021-08-30T22:29:10.053Z'
- updated_at: '2021-08-30T22:29:10.055Z'
+ created_at: '2021-09-21T20:47:33.818Z'
+ updated_at: '2021-09-21T20:47:33.820Z'
meta_title:
meta_description:
meta_keywords:
@@ -2824,8 +2824,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-08-30T22:29:10.139Z'
- updated_at: '2021-08-30T22:29:10.141Z'
+ created_at: '2021-09-21T20:47:33.967Z'
+ updated_at: '2021-09-21T20:47:33.970Z'
meta_title:
meta_description:
meta_keywords:
@@ -2906,8 +2906,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-08-30T22:29:10.185Z'
- updated_at: '2021-08-30T22:29:10.186Z'
+ created_at: '2021-09-21T20:47:34.035Z'
+ updated_at: '2021-09-21T20:47:34.036Z'
meta_title:
meta_description:
meta_keywords:
@@ -2989,8 +2989,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-08-30T22:29:10.259Z'
- updated_at: '2021-08-30T22:29:10.270Z'
+ created_at: '2021-09-21T20:47:34.179Z'
+ updated_at: '2021-09-21T20:47:34.193Z'
meta_title:
meta_description:
meta_keywords:
@@ -3125,9 +3125,9 @@ paths:
- id: '1'
type: user
attributes:
- created_at: '2021-08-30T22:29:10.502Z'
- updated_at: '2021-08-30T22:29:10.502Z'
+ created_at: '2021-09-21T20:47:34.489Z'
+ updated_at: '2021-09-21T20:47:34.489Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3139,9 +3139,9 @@ paths:
- id: '2'
type: user
attributes:
- created_at: '2021-08-30T22:29:10.506Z'
- updated_at: '2021-08-30T22:29:10.506Z'
+ created_at: '2021-09-21T20:47:34.492Z'
+ updated_at: '2021-09-21T20:47:34.492Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3153,9 +3153,9 @@ paths:
- id: '3'
type: user
attributes:
- created_at: '2021-08-30T22:29:10.507Z'
- updated_at: '2021-08-30T22:29:10.507Z'
+ created_at: '2021-09-21T20:47:34.493Z'
+ updated_at: '2021-09-21T20:47:34.493Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3210,9 +3210,9 @@ paths:
id: '2'
type: user
attributes:
- created_at: '2021-08-30T22:29:10.549Z'
- updated_at: '2021-08-30T22:29:10.549Z'
+ created_at: '2021-09-21T20:47:34.534Z'
+ updated_at: '2021-09-21T20:47:34.534Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3271,9 +3271,9 @@ paths:
id: '2'
type: user
attributes:
- created_at: '2021-08-30T22:29:10.578Z'
- updated_at: '2021-08-30T22:29:10.578Z'
+ created_at: '2021-09-21T20:47:34.562Z'
+ updated_at: '2021-09-21T20:47:34.562Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3332,8 +3332,8 @@ paths:
type: user
attributes:
- created_at: '2021-08-30T22:29:10.622Z'
- updated_at: '2021-08-30T22:29:10.627Z'
+ created_at: '2021-09-21T20:47:34.602Z'
+ updated_at: '2021-09-21T20:47:34.612Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3407,6 +3407,671 @@ paths:
Example:
value:
error: The access token is invalid
+ "/api/v2/platform/wished_items":
+ get:
+ summary: Returns a list of Wished Items
+ tags:
+ - Wished Items
+ security:
+ - bearer_auth: []
+ description: Returns a list of Wished Items
+ operationId: wished-items-list
+ parameters:
+ - name: page
+ in: query
+ example: 1
+ schema:
+ type: integer
+ - name: per_page
+ in: query
+ example: 50
+ schema:
+ type: integer
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: variant
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Records returned
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ - id: '1'
+ type: wished_item
+ attributes:
+ quantity: 1
+ created_at: '2021-09-21T20:47:34.780Z'
+ updated_at: '2021-09-21T20:47:34.780Z'
+ price: '19.99'
+ total: '19.99'
+ display_price: "$19.99"
+ display_total: "$19.99"
+ relationships:
+ variant:
+ data:
+ id: '4'
+ type: variant
+ - id: '2'
+ type: wished_item
+ attributes:
+ quantity: 1
+ created_at: '2021-09-21T20:47:34.808Z'
+ updated_at: '2021-09-21T20:47:34.808Z'
+ price: '19.99'
+ total: '19.99'
+ display_price: "$19.99"
+ display_total: "$19.99"
+ relationships:
+ variant:
+ data:
+ id: '6'
+ type: variant
+ - id: '3'
+ type: wished_item
+ attributes:
+ quantity: 1
+ created_at: '2021-09-21T20:47:34.835Z'
+ updated_at: '2021-09-21T20:47:34.835Z'
+ price: '19.99'
+ total: '19.99'
+ display_price: "$19.99"
+ display_total: "$19.99"
+ relationships:
+ variant:
+ data:
+ id: '8'
+ type: variant
+ - id: '4'
+ type: wished_item
+ attributes:
+ quantity: 1
+ created_at: '2021-09-21T20:47:34.860Z'
+ updated_at: '2021-09-21T20:47:34.860Z'
+ price: '19.99'
+ total: '19.99'
+ display_price: "$19.99"
+ display_total: "$19.99"
+ relationships:
+ variant:
+ data:
+ id: '10'
+ type: variant
+ meta:
+ count: 4
+ total_count: 4
+ total_pages: 1
+ links:
+ self: http://www.example.com/api/v2/platform/wished_items?page=1&per_page=&include=
+ next: http://www.example.com/api/v2/platform/wished_items?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/wished_items?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/wished_items?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/wished_items?include=&page=1&per_page=
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ post:
+ summary: Creates a Wished Item
+ tags:
+ - Wished Items
+ security:
+ - bearer_auth: []
+ description: Creates a Wished Item
+ operationId: create-wished-item
+ parameters:
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: variant
+ schema:
+ type: string
+ responses:
+ '201':
+ description: record created
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: wished_item
+ attributes:
+ quantity: 1
+ created_at: '2021-09-21T20:47:35.079Z'
+ updated_at: '2021-09-21T20:47:35.079Z'
+ price: '19.99'
+ total: '19.99'
+ display_price: "$19.99"
+ display_total: "$19.99"
+ relationships:
+ variant:
+ data:
+ id: '2'
+ type: variant
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Variant can't be blank, Wishlist can't be blank, and Quantity
+ is not a number
+ errors:
+ variant:
+ - can't be blank
+ wishlist:
+ - can't be blank
+ quantity:
+ - is not a number
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/wished_item_params"
+ "/api/v2/platform/wished_items/{id}":
+ get:
+ summary: Returns a Wished Item
+ tags:
+ - Wished Items
+ security:
+ - bearer_auth: []
+ description: Returns a Wished Item
+ operationId: show-wished-item
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: variant
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Record found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: wished_item
+ attributes:
+ quantity: 1
+ created_at: '2021-09-21T20:47:35.206Z'
+ updated_at: '2021-09-21T20:47:35.206Z'
+ price: '19.99'
+ total: '19.99'
+ display_price: "$19.99"
+ display_total: "$19.99"
+ relationships:
+ variant:
+ data:
+ id: '4'
+ type: variant
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ put:
+ summary: Updates a Wished Item
+ tags:
+ - Wished Items
+ security:
+ - bearer_auth: []
+ description: Updates a Wished Item
+ operationId: update-wished-item
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: variant
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: wished_item
+ attributes:
+ quantity: 3
+ created_at: '2021-09-21T20:47:35.413Z'
+ updated_at: '2021-09-21T20:47:35.417Z'
+ price: '19.99'
+ total: '59.97'
+ display_price: "$19.99"
+ display_total: "$59.97"
+ relationships:
+ variant:
+ data:
+ id: '4'
+ type: variant
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Quantity is not a number
+ errors:
+ quantity:
+ - is not a number
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/wished_item_params"
+ delete:
+ summary: Deletes a Wished Item
+ tags:
+ - Wished Items
+ security:
+ - bearer_auth: []
+ description: Deletes a Wished Item
+ operationId: delete-wished-item
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Record deleted
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/wishlists":
+ get:
+ summary: Returns a list of Wishlists
+ tags:
+ - Wishlists
+ security:
+ - bearer_auth: []
+ description: Returns a list of Wishlists
+ operationId: wishlists-list
+ parameters:
+ - name: page
+ in: query
+ example: 1
+ schema:
+ type: integer
+ - name: per_page
+ in: query
+ example: 50
+ schema:
+ type: integer
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: wished_items
+ schema:
+ type: string
+ - name: filter
+ in: query
+ description: ''
+ example: name_cont=Birthday
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Records returned
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ - id: '1'
+ type: wishlist
+ attributes:
+ name: Black Friday
+ is_private: true
+ is_default: false
+ created_at: '2021-09-21T20:47:35.895Z'
+ updated_at: '2021-09-21T20:47:35.895Z'
+ token: pJr3H1bG436ZJWwPdhCescuZ
+ variant_included: false
+ relationships:
+ wished_items:
+ data:
+ - id: '1'
+ type: wished_item
+ - id: '2'
+ type: wished_item
+ - id: '2'
+ type: wishlist
+ attributes:
+ name: Birthday
+ is_private: true
+ is_default: false
+ created_at: '2021-09-21T20:47:35.896Z'
+ updated_at: '2021-09-21T20:47:35.896Z'
+ token: g73YVuAfDcznufS7BfkT7Dgv
+ variant_included: false
+ relationships:
+ wished_items:
+ data:
+ - id: '3'
+ type: wished_item
+ - id: '4'
+ type: wished_item
+ meta:
+ count: 2
+ total_count: 2
+ total_pages: 1
+ links:
+ self: http://www.example.com/api/v2/platform/wishlists?page=1&per_page=&include=&filter=
+ next: http://www.example.com/api/v2/platform/wishlists?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/wishlists?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/wishlists?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/wishlists?include=&page=1&per_page=
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ post:
+ summary: Creates a Wishlist
+ tags:
+ - Wishlists
+ security:
+ - bearer_auth: []
+ description: Creates a Wishlist
+ operationId: create-wishlist
+ parameters:
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: wished_items
+ schema:
+ type: string
+ responses:
+ '201':
+ description: record created
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: wishlist
+ attributes:
+ name: Wishlist_26
+ is_private: true
+ is_default: false
+ created_at: '2021-09-21T20:47:36.169Z'
+ updated_at: '2021-09-21T20:47:36.169Z'
+ token: RzyRAZhruHGocmvdDhEEkK3y
+ variant_included: false
+ relationships:
+ wished_items:
+ data: []
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Name can't be blank and User can't be blank
+ errors:
+ name:
+ - can't be blank
+ user:
+ - can't be blank
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/wishlist_params"
+ "/api/v2/platform/wishlists/{id}":
+ get:
+ summary: Returns a Wishlist
+ tags:
+ - Wishlists
+ security:
+ - bearer_auth: []
+ description: Returns a Wishlist
+ operationId: show-wishlist
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: wished_items
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Record found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: wishlist
+ attributes:
+ name: My Wishlist
+ is_private: true
+ is_default: false
+ created_at: '2021-09-21T20:47:36.191Z'
+ updated_at: '2021-09-21T20:47:36.191Z'
+ token: zTKLwrNBQkM1L8FKiCkqFpxX
+ variant_included: false
+ relationships:
+ wished_items:
+ data: []
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ put:
+ summary: Updates a Wishlist
+ tags:
+ - Wishlists
+ security:
+ - bearer_auth: []
+ description: Updates a Wishlist
+ operationId: update-wishlist
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: wished_items
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '1'
+ type: wishlist
+ attributes:
+ name: My Super Wishlist
+ is_private: true
+ is_default: false
+ created_at: '2021-09-21T20:47:36.228Z'
+ updated_at: '2021-09-21T20:47:36.232Z'
+ token: xVvmNoXkzi8i7fvG5i3moE7T
+ variant_included: false
+ relationships:
+ wished_items:
+ data: []
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Name can't be blank
+ errors:
+ name:
+ - can't be blank
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/wishlist_params"
+ delete:
+ summary: Deletes a Wishlist
+ tags:
+ - Wishlists
+ security:
+ - bearer_auth: []
+ description: Deletes a Wishlist
+ operationId: delete-wishlist
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Record deleted
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
servers:
- url: https://{defaultHost}
variables:
@@ -3422,6 +4087,8 @@ tags:
- name: Option Values
- name: Taxons
- name: Users
+- name: Wishlists
+- name: Wished Items
components:
securitySchemes:
bearer_auth:
@@ -3613,6 +4280,26 @@ components:
type: integer
required:
- name
+ wishlist_params:
+ type: object
+ properties:
+ user_id:
+ type: string
+ name:
+ type: string
+ required:
+ - name
+ wished_item_params:
+ type: object
+ properties:
+ wishlist_id:
+ type: string
+ variant_id:
+ type: string
+ quantity:
+ type: integer
+ required:
+ - name
resources_list:
type: object
properties:
diff --git a/api/lib/spree/api/testing_support/v2/platform_contexts.rb b/api/lib/spree/api/testing_support/v2/platform_contexts.rb
index dc8117c289..35cbf4112a 100644
--- a/api/lib/spree/api/testing_support/v2/platform_contexts.rb
+++ b/api/lib/spree/api/testing_support/v2/platform_contexts.rb
@@ -125,7 +125,10 @@ shared_examples 'GET records list' do |resource_name, include_example, filter_ex
operationId "#{resource_name.parameterize.pluralize.to_sym}-list"
include_context 'jsonapi pagination'
json_api_include_parameter(include_example)
- json_api_filter_parameter(filter_example)
+
+ if filter_example.present?
+ json_api_filter_parameter(filter_example)
+ end
before { records_list }
diff --git a/api/spec/integration/api/v2/platform/wished_items_spec.rb b/api/spec/integration/api/v2/platform/wished_items_spec.rb
new file mode 100644
index 0000000000..16a0b43110
--- /dev/null
+++ b/api/spec/integration/api/v2/platform/wished_items_spec.rb
@@ -0,0 +1,29 @@
+require 'swagger_helper'
+
+describe 'Wished Item API', swagger: true do
+ include_context 'Platform API v2'
+
+ resource_name = 'Wished Item'
+ include_example = 'variant'
+
+ let!(:user) { create(:user) }
+ let!(:wishlist) { create(:wishlist) }
+ let!(:variant) { create(:variant) }
+
+ let(:id) { create(:wished_item).id }
+ let(:records_list) { create_list(:wished_item, 4, wishlist: wishlist) }
+
+ let(:valid_create_param_value) { build(:wished_item, wishlist: wishlist, variant: variant).attributes }
+ let(:valid_update_param_value) do
+ {
+ quantity: 3
+ }
+ end
+ let(:invalid_param_value) do
+ {
+ quantity: ''
+ }
+ end
+
+ include_examples 'CRUD examples', resource_name, include_example
+end
diff --git a/api/spec/integration/api/v2/platform/wishlists_spec.rb b/api/spec/integration/api/v2/platform/wishlists_spec.rb
new file mode 100644
index 0000000000..93bb13e7e8
--- /dev/null
+++ b/api/spec/integration/api/v2/platform/wishlists_spec.rb
@@ -0,0 +1,47 @@
+require 'swagger_helper'
+
+describe 'Wishlists API', swagger: true do
+ include_context 'Platform API v2'
+
+ resource_name = 'Wishlist'
+ include_example = 'wished_items'
+ filter_example = 'name_cont=Birthday'
+
+ let!(:user) { create(:user) }
+
+ let(:id) { create(:wishlist, name: 'My Wishlist', user: user).id }
+ let(:records_list) do
+ build_list(:wishlist, 2) do |record, i|
+ record.name = if i == 0
+ 'Black Friday'
+ else
+ 'Birthday'
+ end
+ record.store = store
+ record.user = user
+
+ record.save!
+ end
+
+ wishlist_1 = Spree::Wishlist.first
+ wishlist_2 = Spree::Wishlist.last
+
+ create(:wished_item, wishlist: wishlist_1)
+ create(:wished_item, wishlist: wishlist_1)
+ create(:wished_item, wishlist: wishlist_2)
+ create(:wished_item, wishlist: wishlist_2)
+ end
+ let(:valid_create_param_value) { build(:wishlist, user: user).attributes }
+ let(:valid_update_param_value) do
+ {
+ name: 'My Super Wishlist'
+ }
+ end
+ let(:invalid_param_value) do
+ {
+ name: ''
+ }
+ end
+
+ include_examples 'CRUD examples', resource_name, include_example, filter_example
+end
diff --git a/api/spec/serializers/spree/api/v2/platform/wished_item_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/wished_item_serializer_spec.rb
new file mode 100644
index 0000000000..7d283d2e61
--- /dev/null
+++ b/api/spec/serializers/spree/api/v2/platform/wished_item_serializer_spec.rb
@@ -0,0 +1,43 @@
+require 'spec_helper'
+
+describe Spree::Api::V2::Platform::WishedItemSerializer do
+ subject { described_class.new(wished_item, params: serializer_params) }
+
+ include_context 'API v2 serializers params'
+
+ let!(:user) { create(:user) }
+ let!(:variant) { create(:variant) }
+ let!(:wishlist) { create(:wishlist, user: user) }
+ let!(:wished_item) { create(:wished_item, wishlist: wishlist, variant: variant, quantity: 3) }
+
+ it { expect(subject.serializable_hash).to be_kind_of(Hash) }
+
+ it do
+ expect(subject.serializable_hash).to eq(
+ {
+ data: {
+ id: wished_item.id.to_s,
+ type: :wished_item,
+ attributes: {
+ quantity: 3,
+ price: variant.price,
+ total: variant.price * 3,
+ display_price: '$19.99',
+ display_total: '$59.97',
+ created_at: wished_item.created_at,
+ updated_at: wished_item.updated_at
+ },
+ relationships: {
+ variant: {
+ data:
+ {
+ id: variant.id.to_s,
+ type: :variant
+ }
+ }
+ }
+ }
+ }
+ )
+ end
+end
diff --git a/api/spec/serializers/spree/api/v2/platform/wishlist_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/wishlist_serializer_spec.rb
new file mode 100644
index 0000000000..80ff048487
--- /dev/null
+++ b/api/spec/serializers/spree/api/v2/platform/wishlist_serializer_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+describe Spree::Api::V2::Platform::WishlistSerializer do
+ subject { described_class.new(wishlist) }
+
+ let!(:user) { create(:user) }
+ let!(:wishlist) { create(:wishlist, user: user) }
+ let!(:wished_item) { create(:wished_item, wishlist: wishlist) }
+
+ it { expect(subject.serializable_hash).to be_kind_of(Hash) }
+
+ it do
+ expect(subject.serializable_hash).to eq(
+ {
+ data: {
+ id: wishlist.id.to_s,
+ type: :wishlist,
+ attributes: {
+ name: wishlist.name,
+ is_default: false,
+ is_private: true,
+ token: wishlist.token,
+ variant_included: false,
+ created_at: wishlist.created_at,
+ updated_at: wishlist.updated_at
+ },
+ relationships: {
+ wished_items: {
+ data: [
+ {
+ id: wishlist.wished_items.first.id.to_s,
+ type: :wished_item
+ }
+ ]
+ }
+ }
+ }
+ }
+ )
+ end
+end
diff --git a/api/spec/swagger_helper.rb b/api/spec/swagger_helper.rb
index 06e204b646..5ded65c46a 100644
--- a/api/spec/swagger_helper.rb
+++ b/api/spec/swagger_helper.rb
@@ -40,15 +40,17 @@ RSpec.configure do |config|
}
],
tags: [
- { name: 'Addresses'},
- { name: 'Classifications'},
- { name: 'Countries'},
- { name: 'Menu Items'},
- { name: 'Menus'},
- { name: 'Option Types'},
- { name: 'Option Values'},
- { name: 'Taxons'},
- { name: 'Users'}
+ { name: 'Addresses' },
+ { name: 'Classifications' },
+ { name: 'Countries' },
+ { name: 'Menu Items' },
+ { name: 'Menus' },
+ { name: 'Option Types' },
+ { name: 'Option Values' },
+ { name: 'Taxons' },
+ { name: 'Users' },
+ { name: 'Wishlists' },
+ { name: 'Wished Items' }
],
components: {
securitySchemes: {
@@ -168,16 +170,33 @@ RSpec.configure do |config|
destination: { type: :string },
new_window: { type: :boolean },
item_type: { type: :string },
- linked_resource_type: {type: :string},
- linked_resource_id: {type: :integer}
+ linked_resource_type: { type: :string },
+ linked_resource_id: { type: :integer }
},
required: %w[name]
},
menu_item_reposition_params: {
type: :object,
properties: {
- new_parent_id: {type: :integer},
- new_position_idx: {type: :integer}
+ new_parent_id: { type: :integer },
+ new_position_idx: { type: :integer }
+ },
+ required: %w[name]
+ },
+ wishlist_params: {
+ type: :object,
+ properties: {
+ user_id: { type: :string },
+ name: { type: :string }
+ },
+ required: %w[name]
+ },
+ wished_item_params: {
+ type: :object,
+ properties: {
+ wishlist_id: { type: :string },
+ variant_id: { type: :string },
+ quantity: { type: :integer }
},
required: %w[name]
},