2012-11-07 13:36:00 +00:00
|
|
|
object @search
|
|
|
|
|
|
2013-01-21 05:52:28 +00:00
|
|
|
unless @search.bands.nil? || @search.bands.size == 0
|
|
|
|
|
child(:bands => :bands) {
|
|
|
|
|
attributes :id, :name, :location, :photo_url, :logo_url
|
|
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2013-01-21 05:52:28 +00:00
|
|
|
unless @search.musicians.nil? || @search.musicians.size == 0
|
2013-11-06 10:16:47 +00:00
|
|
|
|
|
|
|
|
node :city do |user|
|
|
|
|
|
current_user.try(:location)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :page_count do |foo|
|
|
|
|
|
@search.page_count
|
|
|
|
|
end
|
|
|
|
|
|
2013-01-21 05:52:28 +00:00
|
|
|
child(:musicians => :musicians) {
|
2013-11-04 14:58:34 +00:00
|
|
|
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url, :biography
|
2013-02-27 22:45:07 +00:00
|
|
|
|
|
|
|
|
node :is_friend do |musician|
|
2013-11-05 14:49:31 +00:00
|
|
|
@search.is_friend?(musician)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :is_following do |musician|
|
2013-11-06 10:16:47 +00:00
|
|
|
@search.is_follower?(musician)
|
2013-11-05 14:49:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :is_liker do |musician|
|
|
|
|
|
@search.is_liker?(musician)
|
2013-02-27 22:45:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
child :musician_instruments => :instruments do
|
|
|
|
|
attributes :instrument_id, :description, :proficiency_level, :priority
|
|
|
|
|
end
|
2013-11-05 10:23:01 +00:00
|
|
|
|
|
|
|
|
child :user_followings => :followings do |uf|
|
|
|
|
|
node :user_id do |uu| uu.following.id end
|
|
|
|
|
node :photo_url do |uu| uu.following.photo_url end
|
|
|
|
|
node :name do |uu| uu.following.name end
|
|
|
|
|
end
|
|
|
|
|
|
2013-11-05 12:25:36 +00:00
|
|
|
node :follow_count do |musician| musician.search_follow_count.to_i rescue 0 end
|
|
|
|
|
node :friend_count do |musician| musician.search_friend_count.to_i rescue 0 end
|
|
|
|
|
node :recording_count do |musician| musician.search_recording_count.to_i rescue 0 end
|
|
|
|
|
node :session_count do |musician| musician.search_session_count.to_i rescue 0 end
|
2013-01-21 05:52:28 +00:00
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2013-01-21 05:52:28 +00:00
|
|
|
unless @search.fans.nil? || @search.fans.size == 0
|
|
|
|
|
child(:fans => :fans) {
|
2013-02-27 22:45:07 +00:00
|
|
|
attributes :id, :first_name, :last_name, :name, :location, :photo_url
|
|
|
|
|
|
|
|
|
|
node :is_friend do |fan|
|
|
|
|
|
fan.friends?(current_user)
|
|
|
|
|
end
|
2013-01-21 05:52:28 +00:00
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2013-01-21 05:52:28 +00:00
|
|
|
unless @search.recordings.nil? || @search.recordings.size == 0
|
|
|
|
|
child(:recordings => :recordings) {
|
|
|
|
|
attributes :id, :name
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
unless @search.friends.nil? || @search.friends.size == 0
|
|
|
|
|
child(:friends => :friends) {
|
2013-03-03 00:30:26 +00:00
|
|
|
attributes :id, :first_name, :last_name, :name, :location, :email, :online, :photo_url, :musician
|
2013-01-21 05:52:28 +00:00
|
|
|
}
|
|
|
|
|
end
|