Files
MatchLiveTv/backend/db/seeds.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

35 lines
1.0 KiB
Ruby

load Rails.root.join("db/seeds/plans.rb")
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
team = Team.find_or_create_by!(name: "Tigers Volley") do |t|
t.sport = "volleyball"
end
UserTeam.find_or_create_by!(user: coach, team: team) { |ut| ut.role = "owner" }
UserTeam.find_or_create_by!(user: admin, team: team) { |ut| ut.role = "member" }
Billing::AssignPlan.call(team: team, plan_slug: "free") unless team.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 "Team: #{team.name}, Match: #{match.opponent_name}"