Limita una diretta attiva per account e valorizza la copertina Premium Full.
Blocca la seconda diretta sullo stesso utente, registra gli abusi in admin e presenta la copertina come grafica caricata dalla società, con demo Team MLTV. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateStreamConcurrencyViolations < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :stream_concurrency_violations, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.references :user, type: :uuid, foreign_key: { on_delete: :nullify }
|
||||
t.references :occupying_session, type: :uuid, foreign_key: { to_table: :stream_sessions, on_delete: :nullify }
|
||||
t.references :attempted_session, type: :uuid, foreign_key: { to_table: :stream_sessions, on_delete: :nullify }
|
||||
t.references :occupying_club, type: :uuid, foreign_key: { to_table: :clubs, on_delete: :nullify }
|
||||
t.references :attempted_club, type: :uuid, foreign_key: { to_table: :clubs, on_delete: :nullify }
|
||||
|
||||
t.string :attempt_action, null: false, default: "start"
|
||||
t.string :user_email, null: false
|
||||
t.string :user_name
|
||||
t.string :occupying_club_name
|
||||
t.string :attempted_club_name
|
||||
t.string :occupying_match_label, null: false
|
||||
t.string :attempted_match_label, null: false
|
||||
t.string :occupying_status
|
||||
t.string :occupying_device
|
||||
t.string :attempted_device
|
||||
t.boolean :devices_differ, null: false, default: false
|
||||
t.jsonb :metadata, null: false, default: {}
|
||||
|
||||
t.datetime :created_at, null: false
|
||||
end
|
||||
|
||||
add_index :stream_concurrency_violations, :created_at
|
||||
add_index :stream_concurrency_violations, :devices_differ
|
||||
add_index :stream_sessions, %i[user_id status], name: "index_stream_sessions_on_user_id_and_status"
|
||||
end
|
||||
end
|
||||
Generated
+36
-2
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_08_28_180000) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_08_31_193000) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
@@ -383,6 +383,34 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_28_180000) do
|
||||
t.index ["stream_session_id"], name: "index_score_states_on_stream_session_id", unique: true
|
||||
end
|
||||
|
||||
create_table "stream_concurrency_violations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "user_id"
|
||||
t.uuid "occupying_session_id"
|
||||
t.uuid "attempted_session_id"
|
||||
t.uuid "occupying_club_id"
|
||||
t.uuid "attempted_club_id"
|
||||
t.string "attempt_action", default: "start", null: false
|
||||
t.string "user_email", null: false
|
||||
t.string "user_name"
|
||||
t.string "occupying_club_name"
|
||||
t.string "attempted_club_name"
|
||||
t.string "occupying_match_label", null: false
|
||||
t.string "attempted_match_label", null: false
|
||||
t.string "occupying_status"
|
||||
t.string "occupying_device"
|
||||
t.string "attempted_device"
|
||||
t.boolean "devices_differ", default: false, null: false
|
||||
t.jsonb "metadata", default: {}, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.index ["attempted_club_id"], name: "index_stream_concurrency_violations_on_attempted_club_id"
|
||||
t.index ["attempted_session_id"], name: "index_stream_concurrency_violations_on_attempted_session_id"
|
||||
t.index ["created_at"], name: "index_stream_concurrency_violations_on_created_at"
|
||||
t.index ["devices_differ"], name: "index_stream_concurrency_violations_on_devices_differ"
|
||||
t.index ["occupying_club_id"], name: "index_stream_concurrency_violations_on_occupying_club_id"
|
||||
t.index ["occupying_session_id"], name: "index_stream_concurrency_violations_on_occupying_session_id"
|
||||
t.index ["user_id"], name: "index_stream_concurrency_violations_on_user_id"
|
||||
end
|
||||
|
||||
create_table "stream_events", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "stream_session_id", null: false
|
||||
t.string "event_type", null: false
|
||||
@@ -440,9 +468,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_28_180000) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "regia_token_digest"
|
||||
t.datetime "regia_token_expires_at"
|
||||
t.boolean "audio_muted", default: false, null: false
|
||||
t.uuid "stream_node_id"
|
||||
t.string "min_quality_preset", default: "auto", null: false
|
||||
t.boolean "audio_muted", default: false, null: false
|
||||
t.string "client_os"
|
||||
t.string "app_version"
|
||||
t.string "app_build"
|
||||
@@ -458,6 +486,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_28_180000) do
|
||||
t.index ["regia_token_digest"], name: "index_stream_sessions_on_regia_token_digest", unique: true
|
||||
t.index ["status"], name: "index_stream_sessions_on_status"
|
||||
t.index ["stream_node_id"], name: "index_stream_sessions_on_stream_node_id"
|
||||
t.index ["user_id", "status"], name: "index_stream_sessions_on_user_id_and_status"
|
||||
t.index ["user_id"], name: "index_stream_sessions_on_user_id"
|
||||
end
|
||||
|
||||
@@ -591,6 +620,11 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_28_180000) do
|
||||
add_foreign_key "recordings", "stream_sessions"
|
||||
add_foreign_key "recordings", "teams"
|
||||
add_foreign_key "score_states", "stream_sessions"
|
||||
add_foreign_key "stream_concurrency_violations", "clubs", column: "attempted_club_id", on_delete: :nullify
|
||||
add_foreign_key "stream_concurrency_violations", "clubs", column: "occupying_club_id", on_delete: :nullify
|
||||
add_foreign_key "stream_concurrency_violations", "stream_sessions", column: "attempted_session_id", on_delete: :nullify
|
||||
add_foreign_key "stream_concurrency_violations", "stream_sessions", column: "occupying_session_id", on_delete: :nullify
|
||||
add_foreign_key "stream_concurrency_violations", "users", on_delete: :nullify
|
||||
add_foreign_key "stream_events", "stream_sessions"
|
||||
add_foreign_key "stream_sessions", "matches"
|
||||
add_foreign_key "stream_sessions", "stream_nodes"
|
||||
|
||||
+5
-5
@@ -16,7 +16,7 @@ admin = User.find_or_create_by!(email: "admin@matchlivetv.test") do |u|
|
||||
u.role = "admin"
|
||||
end
|
||||
|
||||
club = Club.find_or_create_by!(name: "Tigers Volley") do |c|
|
||||
club = Club.find_or_create_by!(name: MatchLiveTv::Demo.home_team) do |c|
|
||||
c.sport = "volleyball"
|
||||
c.primary_color = "#e53935"
|
||||
c.secondary_color = "#ffffff"
|
||||
@@ -24,7 +24,7 @@ end
|
||||
|
||||
ClubMembership.find_or_create_by!(user: coach, club: club) { |m| m.role = "owner" }
|
||||
|
||||
team = club.teams.find_or_create_by!(name: "Under 16") do |t|
|
||||
team = club.teams.find_or_create_by!(name: MatchLiveTv::Demo::CATEGORY) do |t|
|
||||
t.sport = "volleyball"
|
||||
end
|
||||
|
||||
@@ -32,12 +32,12 @@ UserTeam.find_or_create_by!(user: admin, team: team) { |ut| ut.role = "member" }
|
||||
|
||||
Billing::AssignPlan.call(club: club, plan_slug: "free") unless club.subscription
|
||||
|
||||
match = team.matches.find_or_create_by!(opponent_name: "ASD Eagles Pavia") do |m|
|
||||
m.location = "PalaTigers - Milano"
|
||||
match = team.matches.find_or_create_by!(opponent_name: MatchLiveTv::Demo::AWAY_TEAM) do |m|
|
||||
m.location = MatchLiveTv::Demo.venue
|
||||
m.scheduled_at = 2.hours.from_now
|
||||
m.sets_to_win = 3
|
||||
m.roster_numbers = [4, 6, 8, 9, 10, 11, 12, 14, 16, 17, 21]
|
||||
m.category = "U16"
|
||||
m.category = MatchLiveTv::Demo::CATEGORY
|
||||
m.phase = "Semifinale"
|
||||
end
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ coach = User.find_or_create_by!(email: "coach@matchlivetv.test") do |u|
|
||||
end
|
||||
|
||||
clubs_data = [
|
||||
{ name: "Tigers Volley", sport: "volleyball", plan: "premium_full", sessions: 14, hours: 18.5, revenue_yearly: 19900 },
|
||||
{ name: "ASD Eagles Milano", sport: "volleyball", plan: "premium_light", sessions: 9, hours: 11.0, revenue_yearly: 5900 },
|
||||
{ name: "Volley Stars Roma", sport: "volleyball", plan: "premium_full", sessions: 6, hours: 8.0, revenue_yearly: 19900 },
|
||||
{ name: "Basket Juventus U18", sport: "basketball", plan: "premium_light", sessions: 4, hours: 5.5, revenue_yearly: 5900 },
|
||||
{ name: "Padova Beach", sport: "volleyball", plan: "free", sessions: 2, hours: 2.0, revenue_yearly: 0 }
|
||||
{ name: MatchLiveTv::Demo::HOME_TEAM, sport: "volleyball", plan: "premium_full", sessions: 14, hours: 18.5, revenue_yearly: 19900 },
|
||||
{ name: "Team MLTV Nord", sport: "volleyball", plan: "premium_light", sessions: 9, hours: 11.0, revenue_yearly: 5900 },
|
||||
{ name: "Team MLTV Sud", sport: "volleyball", plan: "premium_full", sessions: 6, hours: 8.0, revenue_yearly: 19900 },
|
||||
{ name: "Team MLTV Basket", sport: "basketball", plan: "premium_light", sessions: 4, hours: 5.5, revenue_yearly: 5900 },
|
||||
{ name: MatchLiveTv::Demo::AWAY_TEAM, sport: "volleyball", plan: "free", sessions: 2, hours: 2.0, revenue_yearly: 0 }
|
||||
]
|
||||
|
||||
sport_keys = {
|
||||
@@ -81,7 +81,7 @@ clubs.each_with_index do |row, index|
|
||||
started = day.change(hour: 10 + (n % 6), min: 0)
|
||||
ended = started + secs.seconds
|
||||
match = team.matches.create!(
|
||||
opponent_name: "Avversario demo #{n + 1}",
|
||||
opponent_name: MatchLiveTv::Demo::AWAY_TEAM,
|
||||
sport_key: team.sport_key,
|
||||
scheduled_at: started
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user