Files
MatchLiveTv/backend/app/models/team.rb
Emiliano Frascaro bba6df52c0 Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 17:45:37 +02:00

20 lines
526 B
Ruby

class Team < ApplicationRecord
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 entitlements
@entitlements ||= Teams::Entitlements.new(self)
end
def owner
user_teams.find_by(role: "owner")&.user
end
end