mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
Added id to users API index method
This commit is contained in:
parent
01d0a5d80a
commit
e6f05374d3
2 changed files with 4 additions and 2 deletions
|
@ -29,7 +29,8 @@ class Api::V1::UsersCollection < Api::V1::Collection
|
||||||
users_table[:steamid],
|
users_table[:steamid],
|
||||||
teams_table[:name],
|
teams_table[:name],
|
||||||
teams_table[:tag],
|
teams_table[:tag],
|
||||||
teams_table[:logo]
|
teams_table[:logo],
|
||||||
|
users_table[:id]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ class Api::V1::UsersCollection < Api::V1::Collection
|
||||||
def map_query
|
def map_query
|
||||||
execute_query.map do |row|
|
execute_query.map do |row|
|
||||||
{
|
{
|
||||||
|
id: row[5],
|
||||||
username: row[0],
|
username: row[0],
|
||||||
steamid: row[1],
|
steamid: row[1],
|
||||||
team: {
|
team: {
|
||||||
|
|
|
@ -81,11 +81,11 @@ describe Api::V1::UsersController do
|
||||||
|
|
||||||
it 'returns the excpected JSON keys' do
|
it 'returns the excpected JSON keys' do
|
||||||
get :index
|
get :index
|
||||||
|
|
||||||
user_json = json["users"].first
|
user_json = json["users"].first
|
||||||
nested_team_json = user_json["team"]
|
nested_team_json = user_json["team"]
|
||||||
|
|
||||||
expect(user_json).to have_key("username")
|
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("steamid")
|
||||||
expect(user_json).to have_key("team")
|
expect(user_json).to have_key("team")
|
||||||
expect(nested_team_json).to have_key("name")
|
expect(nested_team_json).to have_key("name")
|
||||||
|
|
Loading…
Reference in a new issue