class ApiFavoritesController < ApiController

  respond_to :json

  before_filter :api_signed_in_user

  def index
    @claimed_recordings, @next = ClaimedRecording.index_favorites(current_user,
                               start: params[:since],
                               limit: params[:limit],
                               sort: params[:sort],
                               type: params[:type],
                               user: params[:user])

    render "api_favorites/index", :layout => nil
  end

  def update
    id = params[:id]
    like = RecordingLiker.find_by_liker_id_and_claimed_recording_id!(current_user.id, id)
    like.favorite = params[:favorite] if params.has_key? :favorite
    like.save

    respond_with_model(like)
  end
end