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