Class: Spree::Api::V2::Tenant::VendorPhotosController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/tenant/vendor_photos_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#current_vendor, #render_serialized_payload, #require_tenant

Instance Method Details

#collection_serializer ⇒ Object



18
19
20
# File 'app/controllers/spree/api/v2/tenant/vendor_photos_controller.rb', line 18

def collection_serializer
  Spree::V2::Tenant::AssetSerializer
end

#index ⇒ Object



6
7
8
9
10
11
12
# File 'app/controllers/spree/api/v2/tenant/vendor_photos_controller.rb', line 6

def index
  collection = scope.page(params[:page]).per(params[:per_page])

  render_serialized_payload do
    serialize_collection(collection)
  end
end

#scope ⇒ Object



14
15
16
# File 'app/controllers/spree/api/v2/tenant/vendor_photos_controller.rb', line 14

def scope
  current_vendor.photos.includes(attachment_attachment: :blob)
end