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:
25
backend/app/services/recordings/index_session.rb
Normal file
25
backend/app/services/recordings/index_session.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
Reference in New Issue
Block a user