Pipeline registrazione/upload con storage S3, archivio web e app, proxy replay per il browser, OAuth YouTube sulla pagina club (Premium Full) e footer legale. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
840 B
Ruby
32 lines
840 B
Ruby
class Club < ApplicationRecord
|
|
include Brandable
|
|
include ClubBillingProfile
|
|
|
|
has_many :club_memberships, dependent: :destroy
|
|
has_many :users, through: :club_memberships
|
|
has_many :teams, dependent: :destroy
|
|
has_one :youtube_credential, dependent: :destroy
|
|
has_one :subscription, dependent: :destroy
|
|
has_many :billing_payments, class_name: "Billing::Payment", dependent: :destroy
|
|
has_many :billing_invoices, class_name: "Billing::Invoice", dependent: :destroy
|
|
|
|
validates :name, presence: true
|
|
validates :sport, presence: true
|
|
validates :primary_color, presence: true
|
|
validates :secondary_color, presence: true
|
|
|
|
def owner
|
|
club_memberships.find_by(role: "owner")&.user
|
|
end
|
|
|
|
def owned_by?(user)
|
|
club_memberships.exists?(user: user, role: "owner")
|
|
end
|
|
|
|
private
|
|
|
|
def branding_parent
|
|
nil
|
|
end
|
|
end
|