2014-10-23 04:10:49 +00:00
|
|
|
# abstracts the idea of downloading / uploading files to JamKazam.
|
|
|
|
|
# Recordings, JamTracks, and Video are this
|
|
|
|
|
|
|
|
|
|
class ApiUserSyncsController < ApiController
|
|
|
|
|
|
|
|
|
|
before_filter :api_signed_in_user, :except => [ ]
|
|
|
|
|
before_filter :auth_user
|
|
|
|
|
|
|
|
|
|
respond_to :json
|
|
|
|
|
|
2015-01-01 05:17:47 +00:00
|
|
|
def log
|
|
|
|
|
@log || Logging.logger[ApiUserSyncsController]
|
|
|
|
|
end
|
2014-10-23 04:10:49 +00:00
|
|
|
|
|
|
|
|
def show
|
|
|
|
|
@user_sync = UserSync.show(params[:user_sync_id], current_user.id)
|
|
|
|
|
|
|
|
|
|
if @user_sync.nil?
|
|
|
|
|
raise ActiveRecord::RecordNotFound
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
render "api_user_syncs/show", :layout => nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# returns all downloads and uploads for a user, meaning it should return:
|
|
|
|
|
# all recorded_tracks (audio and video/soon)
|
|
|
|
|
# all mixes
|
|
|
|
|
# all jamtracks (soon)
|
|
|
|
|
def index
|
|
|
|
|
data = UserSync.index(
|
|
|
|
|
{user_id:current_user.id,
|
|
|
|
|
recording_id: params[:recording_id],
|
|
|
|
|
offset: params[:since],
|
|
|
|
|
limit: params[:limit]})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_syncs = data[:query]
|
|
|
|
|
@next = data[:next]
|
|
|
|
|
render "api_user_syncs/index", :layout => nil
|
|
|
|
|
end
|
2014-11-06 17:26:13 +00:00
|
|
|
|
|
|
|
|
def deletables
|
|
|
|
|
data = UserSync.deletables({user_id:current_user.id, recording_ids: params[:recording_ids]})
|
|
|
|
|
render json: {recording_ids: data}, status: 200
|
|
|
|
|
end
|
2014-10-23 04:10:49 +00:00
|
|
|
end
|