Files
MatchLiveTv/backend/db/seeds.rb
Emiliano Frascaro 4083bc5dee Club come entità principale, branding e fix infrastruttura streaming.
Introduce clubs con abbonamento, branding Active Storage e flusso registrazione società; corregge healthcheck MediaMTX (immagine distroless) e allinea dominio produzione matchlivetv.it.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 09:16:24 +02:00

46 lines
1.3 KiB
Ruby

load Rails.root.join("db/seeds/plans.rb")
AdminAccount.find_or_create_by!(username: "admin") do |a|
a.password = "admin"
end
coach = User.find_or_create_by!(email: "coach@matchlivetv.test") do |u|
u.name = "Coach Demo"
u.password = "password123"
u.role = "coach"
end
admin = User.find_or_create_by!(email: "admin@matchlivetv.test") do |u|
u.name = "Admin"
u.password = "password123"
u.role = "admin"
end
club = Club.find_or_create_by!(name: "Tigers Volley") do |c|
c.sport = "volleyball"
c.primary_color = "#e53935"
c.secondary_color = "#ffffff"
end
ClubMembership.find_or_create_by!(user: coach, club: club) { |m| m.role = "owner" }
team = club.teams.find_or_create_by!(name: "Under 16") do |t|
t.sport = "volleyball"
end
UserTeam.find_or_create_by!(user: admin, team: team) { |ut| ut.role = "member" }
Billing::AssignPlan.call(club: club, plan_slug: "free") unless club.subscription
match = team.matches.find_or_create_by!(opponent_name: "ASD Eagles Pavia") do |m|
m.location = "PalaTigers - Milano"
m.scheduled_at = 2.hours.from_now
m.sets_to_win = 3
m.roster_numbers = [4, 6, 8, 9, 10, 11, 12, 14, 16, 17, 21]
m.category = "U16"
m.phase = "Semifinale"
end
puts "Seed OK: coach@matchlivetv.test / password123"
puts "Club: #{club.name}, Team: #{team.name}, Match: #{match.opponent_name}"