added first and last name fields

This commit is contained in:
Brian Smith 2012-11-10 23:25:28 -05:00
parent bbaa18ba67
commit f5db91c695
10 changed files with 28 additions and 20 deletions

View File

@ -114,7 +114,7 @@ class ApiMusicSessionsController < ApiController
# send out notification to queue to the rest of the session
# TODO: also this isn't necessarily a user leaving; it's a client leaving'
user_joined = @message_factory.user_joined_music_session(@music_session.id, current_user.id, current_user.name)
user_joined = @message_factory.user_joined_music_session(@music_session.id, current_user.id, current_user.first_name + " " + current_user.last_name)
@mq_router.server_publish_to_session(@music_session, user_joined, sender = {:client_id => @connection.client_id})
respond_with @connection, responder: ApiResponder, :location => api_session_participant_detail_url(@connection.client_id)
@ -145,7 +145,7 @@ class ApiMusicSessionsController < ApiController
# send out notification to queue to the rest of the session
# TODO: we should rename the notification to music_session_participants_change or something
# TODO: also this isn't necessarily a user leaving; it's a client leaving'
user_left = @message_factory.user_left_music_session(@music_session.id, current_user.id, current_user.name)
user_left = @message_factory.user_left_music_session(@music_session.id, current_user.id, current_user.first_name + " " + current_user.last_name)
@mq_router.server_publish_to_session(@music_session, user_left, sender = {:client_id => @connection.client_id})
end

View File

@ -2,8 +2,12 @@ object @band.followers
attributes :follower_id => :user_id
node :name do |follower|
follower.user.name
node :first_name do |follower|
follower.user.first_name
end
node :last_name do |follower|
follower.user.last_name
end
node :city do |follower|

View File

@ -4,7 +4,7 @@ attributes :id, :name, :city, :state, :country, :website, :biography, :photo_url
unless @band.users.nil? || @band.users.size == 0
child :users => :musicians do
attributes :id, :name, :photo_url
attributes :id, :first_name, :last_name, :photo_url
# TODO: figure out how to omit empty arrays
node :instruments do |user|

View File

@ -5,11 +5,11 @@ child(:bands => :bands) {
}
child(:musicians => :musicians) {
attributes :id, :name, :location, :photo_url
attributes :id, :first_name, :last_name :location, :photo_url
}
child(:fans => :fans) {
attributes :id, :name, :location, :photo_url
attributes :id, :first_name, :last_name, :location, :photo_url
}
child(:recordings => :recordings) {

View File

@ -2,8 +2,12 @@ object @user.followers
attributes :follower_id => :user_id
node :name do |follower|
follower.user.name
node :first_name do |follower|
follower.user.first_name
end
node :last_name do |follower|
follower.user.last_name
end
node :city do |follower|

View File

@ -2,8 +2,12 @@ object @user.followings
attributes :user_id
node :name do |following|
following.user.name
node :first_name do |following|
following.user.first_name
end
node :last_name do |following|
following.user.last_name
end
node :city do |following|

View File

@ -1,3 +1,3 @@
object @user.friends
attributes :id, :name, :city, :state, :country, :email, :online
attributes :id, :first_name, :last_name, :city, :state, :country, :email, :online

View File

@ -1,4 +1,4 @@
collection @users
# do not retrieve all child collections when showing a list of users
attributes :id, :name, :city, :state, :country, :email, :online, :musician, :photo_url
attributes :id, :first_name, :last_name, :city, :state, :country, :email, :online, :musician, :photo_url

View File

@ -1,10 +1,10 @@
object @user
attributes :id, :name, :city, :state, :country, :email, :online, :photo_url, :friend_count, :follower_count, :following_count
attributes :id, :first_name, :last_name, :city, :state, :country, :email, :online, :photo_url, :friend_count, :follower_count, :following_count
unless @user.friends.nil? || @user.friends.size == 0
child :friends => :friends do
attributes :id, :name, :online
attributes :id, :first_name, :last_name, :online
end
end

View File

@ -74,11 +74,7 @@ SampleApp::Application.routes.draw do
# band followers
match '/bands/:id/followers' => 'api_bands#follower_index', :via => :get
=begin
# band followings
match '/bands/:id/followings' => 'api_bands#following_create', :via => :post
match '/bands/:id/followings/:user_id' => 'api_bands#following_destroy', :via => :delete
=end
# invitations
match '/invitations/:id' => 'api_invitations#show', :via => :get, :as => 'api_invitation_detail'
match '/invitations/:id' => 'api_invitations#delete', :via => :delete