Club come entità principale, branding e fix infrastruttura streaming.

Introduce clubs con abbonamento, branding Active Storage e flusso registrazione società; corregge healthcheck MediaMTX (immagine distroless) e allinea dominio produzione matchlivetv.it.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-27 09:16:24 +02:00
parent 471291b2c4
commit 4083bc5dee
53 changed files with 1120 additions and 197 deletions

View File

@@ -5,8 +5,21 @@ class User < ApplicationRecord
has_many :user_teams, dependent: :destroy
has_many :teams, through: :user_teams
has_many :club_memberships, dependent: :destroy
has_many :clubs, through: :club_memberships
has_many :owned_clubs, -> { where(club_memberships: { role: "owner" }) }, through: :club_memberships, source: :club
has_many :stream_sessions, dependent: :nullify
def manageable_teams
staff_ids = teams.select(:id)
owner_ids = Team.where(club_id: owned_clubs.select(:id)).select(:id)
Team.where(id: staff_ids).or(Team.where(id: owner_ids))
end
def primary_club
owned_clubs.order(:created_at).first
end
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
validates :name, presence: true
validates :role, inclusion: { in: ROLES }