Billing Stripe, link regia mobile e staff solo trasmissione.
Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,8 +8,12 @@ class Team < ApplicationRecord
|
||||
has_one :youtube_credential, dependent: :destroy
|
||||
has_many :recordings, dependent: :destroy
|
||||
has_many :team_invitations, dependent: :destroy
|
||||
has_many :roster_members, class_name: "TeamRosterMember", dependent: :destroy
|
||||
|
||||
has_one_attached :photo_file
|
||||
|
||||
validates :name, presence: true
|
||||
validate :photo_file_type, if: -> { photo_file.attached? }
|
||||
|
||||
def subscription
|
||||
club.subscription
|
||||
@@ -23,8 +27,26 @@ class Team < ApplicationRecord
|
||||
club&.owner
|
||||
end
|
||||
|
||||
def team_photo_url
|
||||
if photo_file.attached?
|
||||
Rails.application.routes.url_helpers.rails_blob_path(photo_file, only_path: true)
|
||||
end
|
||||
end
|
||||
|
||||
def roster_by_category
|
||||
TeamRosterMember::DISPLAY_ORDER.index_with do |cat|
|
||||
roster_members.by_category(cat).to_a
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def photo_file_type
|
||||
return if photo_file.content_type.in?(%w[image/png image/jpeg image/webp])
|
||||
|
||||
errors.add(:photo_file, "deve essere PNG, JPEG o WebP")
|
||||
end
|
||||
|
||||
def branding_parent
|
||||
club
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user