Stabilizza regia, live web e sync punteggi app nativa.
Corregge scadenza token regia oltre le 8h, tabellone HTML sulla pagina live, pulsanti pausa/ripresa in regia, link admin e broadcast ActionCable diretto. App Android: overlay branding, sync score da regia via WebSocket con reconnect e poll. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
module Api
|
||||
module V1
|
||||
class TeamsController < BaseController
|
||||
include Api::UrlHelper
|
||||
include BrandingAttachments
|
||||
|
||||
def index
|
||||
teams = current_user.streamable_teams
|
||||
render json: teams.map { |t| team_json(t) }
|
||||
@@ -48,6 +51,7 @@ module Api
|
||||
def update
|
||||
team = current_user.manageable_teams.find(params[:id])
|
||||
team.update!(team_params)
|
||||
attach_team_logo(team)
|
||||
render json: team_json(team)
|
||||
end
|
||||
|
||||
@@ -69,7 +73,19 @@ module Api
|
||||
private
|
||||
|
||||
def team_params
|
||||
params.require(:team).permit(:name, :sport, :logo_url)
|
||||
p = params.require(:team).permit(:name, :sport, :logo_url, :primary_color, :secondary_color)
|
||||
if p[:primary_color].present?
|
||||
p[:primary_color] = normalize_hex_color(p[:primary_color], p[:primary_color])
|
||||
end
|
||||
if p[:secondary_color].present?
|
||||
p[:secondary_color] = normalize_hex_color(p[:secondary_color], p[:secondary_color])
|
||||
end
|
||||
p
|
||||
end
|
||||
|
||||
def attach_team_logo(team)
|
||||
file = params[:logo_file]
|
||||
team.logo_file.attach(file) if file.present?
|
||||
end
|
||||
|
||||
def team_json(team, detail: false)
|
||||
@@ -80,7 +96,7 @@ module Api
|
||||
id: team.id,
|
||||
name: team.name,
|
||||
sport: team.sport,
|
||||
logo_url: team.effective_logo_url,
|
||||
logo_url: api_absolute_url(team.effective_logo_url),
|
||||
primary_color: team.effective_primary_color,
|
||||
secondary_color: team.effective_secondary_color,
|
||||
club_id: team.club_id,
|
||||
|
||||
Reference in New Issue
Block a user