jam-cloud/web/app/views/api_users/profile_show.rabl

75 lines
2.6 KiB
Ruby

object @profile
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :follower_count, :following_count, :recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :concert_count, :studio_session_count, :virtual_band, :virtual_band_commitment, :traditional_band, :traditional_band_commitment, :traditional_band_touring, :paid_sessions, :paid_sessions_hourly_rate,
:paid_sessions_daily_rate, :free_sessions, :cowriting, :cowriting_purpose, :subscribe_email, :is_a_teacher, :is_a_student, :last_active_timestamp, :v2_photo_url, :v2_photo_uploaded, :has_stored_credit_card?
node :has_recurly_account do |user|
user.recurly_code == user.id
end
child :online_presences => :online_presences do
attributes :id, :service_type, :username
end
child :performance_samples => :performance_samples do
attributes :id, :url, :service_type, :claimed_recording_id, :service_id, :description
child :claimed_recording => :claimed_recording do
attributes :id, :name
end
end
child :genre_players => :genres do
attributes :genre_id, :player_type, :genre_type, :description
end
child :band_musicians => :bands do
attributes :id, :name, :admin, :photo_url, :logo_url, :website
child :genres => :genres do
attributes :id, :description
#partial('api_genres/index', :object => @user.bands.genres)
end
end
child :musician_instruments => :instruments do
attributes :description, :proficiency_level, :priority, :instrument_id
end
# node :last_active_timestamp do |user|
# if user.updated_at || user.last_jam_updated_at
# [user.updated_at, user.last_jam_updated_at].compact.max.to_i
# end
# end
node :created_at_timestamp do |user|
user.created_at.to_i
end
if @show_teacher_profile && @profile && @profile.teacher
node :teacher do
partial("api_teachers/detail", :object => @profile.teacher)
end
end
if current_user && @profile != current_user
node :is_friend do |uu|
current_user.friends?(uu)
end
node :is_following do |uu|
current_user.following?(uu)
end
node :is_liking do |uu|
current_user.likes?(uu)
end
node :pending_friend_request do |uu|
current_user.pending_friend_request?(uu)
end
node :my_audio_latency do |user|
current_user.last_jam_audio_latency.round if current_user.last_jam_audio_latency
end
node :internet_score do |user|
current_user.score_info(user)
end
end