mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-30 22:41:33 +00:00
24 lines
551 B
Ruby
24 lines
551 B
Ruby
|
class Api::V1::TeamsController < Api::V1::BaseController
|
||
|
def index
|
||
|
render json: Api::V1::UsersCollection.as_json
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
@team = Team.find params[:id]
|
||
|
render json: {
|
||
|
id: @team.id,
|
||
|
name: @team.name,
|
||
|
logo: @team.logo,
|
||
|
members: @team.teamers.active.map do |m|
|
||
|
{
|
||
|
id: m.user.id,
|
||
|
username: m.user.username,
|
||
|
steamid: m.user.steamid
|
||
|
}
|
||
|
end
|
||
|
}
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
raise ActionController::RoutingError.new("User Not Found")
|
||
|
end
|
||
|
end
|