Aggiunge gestione archivio replay nel pannello admin.

Gli admin possono vedere, modificare ed eliminare i replay di una società come la squadra proprietaria, riusando la stessa UI e logica dell'archivio pubblico.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-13 09:01:38 +02:00
parent da75582dae
commit 89854869c7
15 changed files with 455 additions and 219 deletions

View File

@@ -0,0 +1,36 @@
require "rails_helper"
RSpec.describe Recordings::ClubArchive do
let!(:club) { Club.create!(name: "Club", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
let!(:team_a) { club.teams.create!(name: "A", sport: "volleyball") }
let!(:team_b) { club.teams.create!(name: "B", sport: "volleyball") }
let!(:user) { User.create!(email: "coach@test.com", name: "Coach", password: "password123", role: "coach") }
let!(:match_a) { team_a.matches.create!(opponent_name: "Rival A", scheduled_at: 1.day.ago) }
let!(:match_b) { team_b.matches.create!(opponent_name: "Rival B", scheduled_at: 1.day.ago) }
let!(:session_a) do
StreamSession.create!(match: match_a, user: user, platform: "matchlivetv", status: "ended", ended_at: 1.hour.ago)
end
let!(:session_b) do
StreamSession.create!(match: match_b, user: user, platform: "matchlivetv", status: "ended", ended_at: 1.hour.ago)
end
let!(:ready_a) do
Recording.create!(
stream_session: session_a, team: team_a, status: "ready", privacy_status: "public",
storage_key: "teams/#{team_a.id}/sessions/#{session_a.id}/replay.mp4",
expires_at: 30.days.from_now
)
end
let!(:processing_b) do
Recording.create!(stream_session: session_b, team: team_b, status: "processing", privacy_status: "unlisted")
end
it "filtra per squadra" do
archive = described_class.new(club, params: { team_id: team_a.id })
expect(archive.recordings).to contain_exactly(ready_a)
end
it "filtra per stato ready" do
archive = described_class.new(club, params: { status: "ready" })
expect(archive.recordings).to contain_exactly(ready_a)
end
end