2012-11-07 13:36:00 +00:00
|
|
|
object @search
|
|
|
|
|
|
2013-12-09 19:54:02 +00:00
|
|
|
if @search.bands.present?
|
2013-01-21 05:52:28 +00:00
|
|
|
child(:bands => :bands) {
|
|
|
|
|
attributes :id, :name, :location, :photo_url, :logo_url
|
|
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2013-12-09 19:54:02 +00:00
|
|
|
if @search.musicians.present?
|
|
|
|
|
child(:musicians => :musicians) {
|
|
|
|
|
attributes :id, :first_name, :last_name, :name, :location, :photo_url
|
|
|
|
|
|
|
|
|
|
node :is_friend do |musician|
|
|
|
|
|
musician.friends?(current_user)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
child :musician_instruments => :instruments do
|
|
|
|
|
attributes :instrument_id, :description, :proficiency_level, :priority
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if @search.musicians_filter.present?
|
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-12-09 19:54:02 +00:00
|
|
|
child(:musicians_filter => :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
|
|
|
|
|
|
2013-02-27 22:45:07 +00:00
|
|
|
child :musician_instruments => :instruments do
|
|
|
|
|
attributes :instrument_id, :description, :proficiency_level, :priority
|
|
|
|
|
end
|
2013-11-05 10:23:01 +00:00
|
|
|
|
2013-11-15 20:03:03 +00:00
|
|
|
child :top_followings => :followings do |uf|
|
|
|
|
|
node :user_id do |uu| uu.id end
|
|
|
|
|
node :photo_url do |uu| uu.photo_url end
|
|
|
|
|
node :name do |uu| uu.name end
|
2013-11-05 10:23:01 +00:00
|
|
|
end
|
|
|
|
|
|
2013-11-06 13:50:34 +00:00
|
|
|
node :follow_count do |musician| @search.follow_count(musician) end
|
|
|
|
|
node :friend_count do |musician| @search.friend_count(musician) end
|
|
|
|
|
node :recording_count do |musician| @search.record_count(musician) end
|
|
|
|
|
node :session_count do |musician| @search.session_count(musician) 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
|