Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
526 B
Ruby
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
|