Commit 75149d8b by ivan Lan

Finish Merchant Snapshot Controller

parent dad4f10a
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:spec, :banners, :cover_image, :detail, :meta
\ No newline at end of file
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:total_price, :total_original_price, :revised_amount,
:spec, :cover_image, :banners, :detail, :meta
\ No newline at end of file
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:total_price, :total_original_price, :revised_amount
:total_price, :total_original_price, :revised_amount,
:spec, :cover_image, :meta
\ No newline at end of file
......@@ -5,8 +5,10 @@ module Shotengai
self.resources = ProductSeries
self.template_dir = 'shotengai/merchant/series/'
default_query do |klass, params|
klass.where(shotengai_product_id: params[:product_id])
default_query do |resource, params|
resource.where(
params[:product_id] && { shotengai_product_id: params[:product_id] }
)
end
private
......
module Shotengai
module Controller
module Merchant
class SnapshotsController < Shotengai::Controller::Base
class ProductSnapshotsController < Shotengai::Controller::Base
self.resources = ProductSnapshot
self.template_dir = 'shotengai/merchant/snapshots/'
remove_actions :create, :destroy
default_query do |resource, params|
resource.in_order
end
index_query do |resource, params|
# where(nil) will skip the where
resource.where(
params[:order_id] && { shotengai_order_id: params[:order_id] }
).where(
params[:product_series_id] && { shotengai_series_id: params[:product_series_id] }
)
end
private
def resource_params
params.require(resource_key).permit(
:revised_amount
)
end
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment