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

@@ -1,19 +1,39 @@
class Team < ApplicationRecord
include Brandable
belongs_to :club
has_many :user_teams, dependent: :destroy
has_many :users, through: :user_teams
has_many :matches, dependent: :destroy
has_one :youtube_credential, dependent: :destroy
has_one :subscription, dependent: :destroy
has_many :recordings, dependent: :destroy
has_many :team_invitations, dependent: :destroy
validates :name, presence: true
def subscription
club.subscription
end
def entitlements
@entitlements ||= Teams::Entitlements.new(self)
Teams::Entitlements.new(self)
end
def owner
user_teams.find_by(role: "owner")&.user
club&.owner
end
private
def branding_parent
club
end
def default_primary_color
club&.primary_color.presence || super
end
def default_secondary_color
club&.secondary_color.presence || super
end
end