Files
MatchLiveTv/backend/app/models/device_state.rb
Emiliano Frascaro bba6df52c0 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>
2026-05-26 17:45:37 +02:00

20 lines
444 B
Ruby

class DeviceState < ApplicationRecord
ROLES = %w[camera controller].freeze
belongs_to :stream_session
validates :device_role, inclusion: { in: ROLES }
validates :device_role, uniqueness: { scope: :stream_session_id }
def as_cable_payload
{
type: "device_state",
battery: battery_level,
network: network_type,
bitrate: current_bitrate,
fps: fps,
status: stream_session.status
}
end
end