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>
This commit is contained in:
21
backend/app/models/recording.rb
Normal file
21
backend/app/models/recording.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class Recording < ApplicationRecord
|
||||
STATUSES = %w[processing ready expired].freeze
|
||||
|
||||
belongs_to :stream_session
|
||||
belongs_to :team
|
||||
|
||||
validates :status, inclusion: { in: STATUSES }
|
||||
|
||||
scope :ready, -> { where(status: "ready").where("expires_at IS NULL OR expires_at > ?", Time.current) }
|
||||
scope :for_team, ->(team) { where(team: team) }
|
||||
|
||||
def replay_url
|
||||
return nil unless ready? && stream_session_id.present?
|
||||
|
||||
"#{MatchLiveTv.app_public_url.chomp('/')}/replay/#{stream_session_id}"
|
||||
end
|
||||
|
||||
def ready?
|
||||
status == "ready" && (expires_at.nil? || expires_at.future?)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user