2012-11-07 13:36:00 +00:00
|
|
|
object @search
|
|
|
|
|
|
2014-01-12 02:18:20 +00:00
|
|
|
node :search_type do |ss| ss.search_type end
|
|
|
|
|
|
2015-04-02 14:52:16 +00:00
|
|
|
if @search.is_a?(MusicianSearch)
|
|
|
|
|
|
|
|
|
|
node :page_count do |foo|
|
|
|
|
|
@search.page_count
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :my_audio_latency do |user|
|
|
|
|
|
current_user.last_jam_audio_latency.round if current_user.last_jam_audio_latency
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-04 14:55:41 +00:00
|
|
|
node :description do |foo|
|
|
|
|
|
@search.description
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :is_blank_filter do |foo|
|
|
|
|
|
@search.is_blank?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :filter_json do |foo|
|
|
|
|
|
@search.json
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-02 14:52:16 +00:00
|
|
|
child(:results => :musicians) {
|
|
|
|
|
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :online, :musician, :photo_url, :biography, :regionname, :score, :full_score
|
|
|
|
|
|
|
|
|
|
node :is_friend do |musician|
|
|
|
|
|
@search.is_friend?(musician)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :is_following do |musician|
|
|
|
|
|
@search.is_follower?(musician)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :pending_friend_request do |musician|
|
|
|
|
|
musician.pending_friend_request?(current_user)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :biography do |musician|
|
|
|
|
|
musician.biography.nil? ? "" : musician.biography
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
child :musician_instruments => :instruments do
|
|
|
|
|
attributes :instrument_id, :description, :proficiency_level, :priority
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
node :audio_latency do |musician|
|
|
|
|
|
last_jam_audio_latency(musician)
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
2014-02-16 07:15:24 +00:00
|
|
|
if @search.session_invite_search?
|
|
|
|
|
child(:results => :suggestions) {
|
|
|
|
|
node :value do |uu| uu.name end
|
|
|
|
|
node :data do |uu| uu.id end
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-11 15:12:26 +00:00
|
|
|
if @search.bands_text_search?
|
2014-01-11 15:27:56 +00:00
|
|
|
child(:results => :bands) {
|
2014-01-12 07:40:30 +00:00
|
|
|
attributes :id, :name, :location, :photo_url, :logo_url, :website
|
2013-01-21 05:52:28 +00:00
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2014-01-11 15:12:26 +00:00
|
|
|
if @search.musicians_text_search?
|
2014-01-11 15:27:56 +00:00
|
|
|
child(:results => :musicians) {
|
2013-12-09 19:54:02 +00:00
|
|
|
attributes :id, :first_name, :last_name, :name, :location, :photo_url
|
|
|
|
|
|
|
|
|
|
node :is_friend do |musician|
|
|
|
|
|
musician.friends?(current_user)
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-24 06:10:09 +00:00
|
|
|
node :pending_friend_request do |musician|
|
|
|
|
|
musician.pending_friend_request?(current_user)
|
|
|
|
|
end
|
|
|
|
|
|
2013-12-09 19:54:02 +00:00
|
|
|
child :musician_instruments => :instruments do
|
|
|
|
|
attributes :instrument_id, :description, :proficiency_level, :priority
|
|
|
|
|
end
|
|
|
|
|
}
|
2014-02-25 06:27:13 +00:00
|
|
|
end
|
2013-12-09 19:54:02 +00:00
|
|
|
|
2014-02-25 06:27:13 +00:00
|
|
|
if @search.musicians_filter_search?
|
2013-11-06 10:16:47 +00:00
|
|
|
|
|
|
|
|
node :page_count do |foo|
|
|
|
|
|
@search.page_count
|
|
|
|
|
end
|
2014-07-29 22:52:20 +00:00
|
|
|
|
|
|
|
|
node :my_audio_latency do |user|
|
2014-08-18 15:37:55 +00:00
|
|
|
current_user.last_jam_audio_latency.round if current_user.last_jam_audio_latency
|
2014-07-29 22:52:20 +00:00
|
|
|
end
|
2015-04-04 14:55:41 +00:00
|
|
|
|
|
|
|
|
node :description do |foo|
|
|
|
|
|
@search.description
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :is_blank_filter do |foo|
|
|
|
|
|
@search.is_blank?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :filter_json do |foo|
|
|
|
|
|
@search.json
|
|
|
|
|
end
|
2013-11-06 10:16:47 +00:00
|
|
|
|
2014-01-11 15:27:56 +00:00
|
|
|
child(:results => :musicians) {
|
2014-08-21 19:58:14 +00:00
|
|
|
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :online, :musician, :photo_url, :biography, :regionname, :score, :full_score
|
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
|
|
|
|
|
|
2014-02-24 06:10:09 +00:00
|
|
|
node :pending_friend_request do |musician|
|
2014-02-25 01:51:59 +00:00
|
|
|
musician.pending_friend_request?(current_user)
|
2014-02-24 06:10:09 +00:00
|
|
|
end
|
|
|
|
|
|
2014-01-22 02:55:38 +00:00
|
|
|
node :biography do |musician|
|
|
|
|
|
musician.biography.nil? ? "" : musician.biography
|
|
|
|
|
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
|
2014-08-20 01:58:24 +00:00
|
|
|
|
|
|
|
|
node :audio_latency do |musician|
|
|
|
|
|
last_jam_audio_latency(musician)
|
|
|
|
|
end
|
2013-01-21 05:52:28 +00:00
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2014-01-11 15:12:26 +00:00
|
|
|
if @search.bands_filter_search?
|
2013-12-16 18:31:12 +00:00
|
|
|
|
|
|
|
|
node :page_count do |foo|
|
|
|
|
|
@search.page_count
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-11 15:27:56 +00:00
|
|
|
child(:results => :bands) {
|
2014-08-21 19:58:14 +00:00
|
|
|
attributes :id, :name, :city, :state, :country, :photo_url, :biography, :logo_url, :website
|
2013-12-16 18:31:12 +00:00
|
|
|
|
|
|
|
|
node :is_following do |band|
|
|
|
|
|
@search.is_follower?(band)
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-22 02:56:03 +00:00
|
|
|
node :biography do |band|
|
|
|
|
|
band.biography.nil? ? "" : band.biography
|
|
|
|
|
end
|
|
|
|
|
|
2013-12-17 16:59:16 +00:00
|
|
|
child :genres => :genres do
|
2013-12-16 18:31:12 +00:00
|
|
|
attributes :genre_id, :description
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
child :users => :players do |pl|
|
|
|
|
|
node :user_id do |uu| uu.id end
|
|
|
|
|
node :photo_url do |uu| uu.photo_url end
|
|
|
|
|
node :name do |uu| uu.name end
|
2014-01-22 02:54:39 +00:00
|
|
|
node :instruments do |uu| uu.instruments.map(&:id).join(',') end
|
2013-12-16 18:31:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
node :follow_count do |band| @search.follow_count(band) end
|
|
|
|
|
node :recording_count do |band| @search.record_count(band) end
|
|
|
|
|
node :session_count do |band| @search.session_count(band) end
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-11 15:12:26 +00:00
|
|
|
if @search.fans_text_search?
|
2014-01-11 15:27:56 +00:00
|
|
|
child(:results => :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
|
2014-02-24 06:10:09 +00:00
|
|
|
|
2014-02-24 18:05:29 +00:00
|
|
|
node :pending_friend_request do |fan|
|
|
|
|
|
fan.pending_friend_request?(current_user)
|
2014-02-24 06:10:09 +00:00
|
|
|
end
|
2013-01-21 05:52:28 +00:00
|
|
|
}
|
|
|
|
|
end
|
2012-11-07 13:36:00 +00:00
|
|
|
|
2015-04-02 14:52:16 +00:00
|
|
|
end
|