summaryrefslogtreecommitdiff
path: root/app/controllers/api/v1/photos_controller.rb
blob: 41bee03ff1277a3fdd514b0588043a70d11a47f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Api
  module V1
    class PhotosController < ApiController
      def index
        @photos = current_user.creations.find(params[:cake_id]).photos
      end

      def show
        @photo = current_user.creations.find(params[:cake_id]).photos.find(params[:id])
      end

      def create
        cake = current_user.creations.find(params[:cake_id])
        @photo = UploadPhoto.new(cake).run(params)
      end
    end
  end
end