diff --git a/app/services/api/v1/users_collection.rb b/app/services/api/v1/users_collection.rb index 8065d41..2630913 100644 --- a/app/services/api/v1/users_collection.rb +++ b/app/services/api/v1/users_collection.rb @@ -29,7 +29,8 @@ class Api::V1::UsersCollection < Api::V1::Collection users_table[:steamid], teams_table[:name], teams_table[:tag], - teams_table[:logo] + teams_table[:logo], + users_table[:id] ] end @@ -45,6 +46,7 @@ class Api::V1::UsersCollection < Api::V1::Collection def map_query execute_query.map do |row| { + id: row[5], username: row[0], steamid: row[1], team: { diff --git a/spec/controllers/api/v1/users_controller_spec.rb b/spec/controllers/api/v1/users_controller_spec.rb index 72b42ab..3a8d07e 100644 --- a/spec/controllers/api/v1/users_controller_spec.rb +++ b/spec/controllers/api/v1/users_controller_spec.rb @@ -81,11 +81,11 @@ describe Api::V1::UsersController do it 'returns the excpected JSON keys' do get :index - user_json = json["users"].first nested_team_json = user_json["team"] expect(user_json).to have_key("username") + expect(user_json).to have_key("id") expect(user_json).to have_key("steamid") expect(user_json).to have_key("team") expect(nested_team_json).to have_key("name")