VRFS-2695 wip get user profile API

This commit is contained in:
Brian Smith 2015-02-13 22:45:19 -05:00
parent a09894b974
commit a778eaef28
3 changed files with 9 additions and 5 deletions

View File

@ -32,17 +32,20 @@ class ApiUsersController < ApiController
respond_with @user, responder: ApiResponder, :status => 200
end
def profile
def profile_show
@profile = User.includes([{musician_instruments: :instrument},
{band_musicians: :user},
{genre_players: :genre},
:bands, :instruments, :genres,
:user_presences, :performance_samples])
:online_presences, :performance_samples])
.find(params[:id])
respond_with @profile, responder: ApiResponder, :status => 200
end
def profile_save
end
def update
@user = User.find(params[:id])

View File

@ -3,7 +3,7 @@ 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
child :user_presences => :online_presences do
child :online_presences => :online_presences do
attributes :id, :service_type, :username
end
@ -16,5 +16,5 @@ child :performance_samples => :performance_samples do
end
child :genre_players => :genres do
attributes :genre_id, :player_type
attributes :genre_id, :player_type, :genre_type
end

View File

@ -341,7 +341,8 @@ SampleApp::Application.routes.draw do
match '/users/:id/share/recording/:provider' => 'api_users#share_recording', :via => :get
#profile
match '/users/:id/profile' => 'api_users#profile', :via => :get, :as => 'api_users_profile'
match '/users/:id/profile' => 'api_users#profile_show', :via => :get, :as => 'api_users_profile_show'
match '/users/:id/profile' => 'api_users#profile_save', :via => :post
# session chat
match '/chat' => 'api_chats#create', :via => :post