Billing Stripe, link regia mobile e staff solo trasmissione.
Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,11 +40,13 @@ module Api
|
||||
private
|
||||
|
||||
def set_team
|
||||
@team = current_user.manageable_teams.find(params[:team_id])
|
||||
@team = current_user.streamable_teams.find { |t| t.id == params[:team_id] }
|
||||
raise ActiveRecord::RecordNotFound unless @team
|
||||
end
|
||||
|
||||
def set_match
|
||||
@match = Match.joins(:team).merge(current_user.manageable_teams).find(params[:id])
|
||||
team_ids = current_user.streamable_teams.map(&:id)
|
||||
@match = Match.where(team_id: team_ids).find(params[:id])
|
||||
end
|
||||
|
||||
def match_params
|
||||
|
||||
@@ -4,7 +4,8 @@ module Api
|
||||
before_action :set_session, except: :create
|
||||
|
||||
def create
|
||||
match = Match.joins(:team).merge(current_user.manageable_teams).find(params[:match_id])
|
||||
team_ids = current_user.streamable_teams.map(&:id)
|
||||
match = Match.where(team_id: team_ids).find(params[:match_id])
|
||||
session = Sessions::Create.new(user: current_user, match: match, params: session_params).call
|
||||
render json: session_json(session), status: :created
|
||||
end
|
||||
@@ -66,6 +67,15 @@ module Api
|
||||
}
|
||||
end
|
||||
|
||||
def regia_link
|
||||
access = Sessions::RegiaAccess.new(@session)
|
||||
token = access.issue_token!
|
||||
render json: {
|
||||
regia_url: access.url(token),
|
||||
expires_at: @session.regia_token_expires_at
|
||||
}
|
||||
end
|
||||
|
||||
def claim_pairing
|
||||
token = params.require(:pairing_token)
|
||||
digest = Digest::SHA256.hexdigest(token)
|
||||
@@ -101,8 +111,9 @@ module Api
|
||||
private
|
||||
|
||||
def set_session
|
||||
@session = StreamSession.joins(match: :team)
|
||||
.merge(current_user.manageable_teams)
|
||||
team_ids = current_user.streamable_teams.map(&:id)
|
||||
@session = StreamSession.joins(:match)
|
||||
.where(matches: { team_id: team_ids })
|
||||
.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module Api
|
||||
module V1
|
||||
class TeamsController < BaseController
|
||||
def index
|
||||
teams = current_user.manageable_teams.includes(:club, :matches)
|
||||
teams = current_user.streamable_teams
|
||||
render json: teams.map { |t| team_json(t) }
|
||||
end
|
||||
|
||||
@@ -27,7 +27,8 @@ module Api
|
||||
end
|
||||
|
||||
def recordings
|
||||
team = current_user.manageable_teams.find(params[:id])
|
||||
team = current_user.streamable_teams.find { |t| t.id.to_s == params[:id].to_s }
|
||||
raise ActiveRecord::RecordNotFound unless team
|
||||
unless team.entitlements.can_access_recordings?
|
||||
return render json: {
|
||||
error: "Archivio gare disponibile con Premium Light o Full",
|
||||
@@ -89,16 +90,16 @@ module Api
|
||||
staff_manage_url: ent.staff_manage_url,
|
||||
max_staff: ent.max_staff,
|
||||
max_staff_transmission: ent.max_staff_transmission,
|
||||
max_staff_regia: ent.max_staff_regia,
|
||||
staff_used: ent.staff_count,
|
||||
staff_transmission_used: ent.staff_count_for("transmission"),
|
||||
staff_regia_used: ent.staff_count_for("regia"),
|
||||
concurrent_streams_used: ent.concurrent_streams_used,
|
||||
concurrent_streams_limit: ent.concurrent_streams_limit,
|
||||
recordings_enabled: ent.can_access_recordings?,
|
||||
phone_download_enabled: ent.phone_download_enabled?,
|
||||
youtube_enabled: ent.youtube_enabled?,
|
||||
youtube_mode: ent.plan.youtube_mode
|
||||
youtube_mode: ent.plan.youtube_mode,
|
||||
staff_role: current_user.staff_role_for(team),
|
||||
can_stream: current_user.can_stream_for?(team)
|
||||
}
|
||||
if detail
|
||||
data[:members] = team.user_teams.includes(:user).where.not(role: "owner").map do |ut|
|
||||
|
||||
Reference in New Issue
Block a user