Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
659 B
Ruby
26 lines
659 B
Ruby
module Recordings
|
|
class IndexSession
|
|
def initialize(session)
|
|
@session = session
|
|
end
|
|
|
|
def call
|
|
team = @session.match.team
|
|
return unless team.entitlements.can_access_recordings?
|
|
|
|
retention_days = team.entitlements.recording_retention_days
|
|
expires_at = retention_days.positive? ? retention_days.days.from_now : nil
|
|
|
|
recording = Recording.find_or_initialize_by(stream_session: @session)
|
|
recording.assign_attributes(
|
|
team: team,
|
|
status: "ready",
|
|
storage_path: @session.mediamtx_path_name,
|
|
expires_at: expires_at
|
|
)
|
|
recording.save!
|
|
recording
|
|
end
|
|
end
|
|
end
|