|
1 | | -# frozen_string_literal: true |
2 | | - |
3 | | -# Seeds file for ProStaff API - Development/Testing Data |
4 | | -# |
5 | | -# SECURITY NOTE: This file creates development-only accounts |
6 | | -# Never use these credentials in production! |
7 | | - |
8 | | -# Get password from ENV or use default for development |
9 | | -DEFAULT_DEV_PASSWORD = ENV.fetch('DEV_SEED_PASSWORD', 'password123') |
10 | | - |
11 | | -puts '🌱 Seeding database with organizations...' |
12 | | - |
13 | | -# ============================================================================ |
14 | | -# TIME 1: Java E-sports (Tier 1 Professional) |
15 | | -# ============================================================================ |
16 | | -puts "\n📍 Creating Java E-sports..." |
17 | | - |
18 | | -org1 = Organization.find_or_create_by!(id: '043824c0-906f-4aa2-9bc7-11d668b508dc') do |organization| |
19 | | - organization.name = 'Java E-sports' |
20 | | - organization.slug = 'java-esports' |
21 | | - organization.region = 'BR' |
22 | | - organization.tier = 'tier_1_professional' |
23 | | - organization.subscription_plan = 'professional' |
24 | | - organization.subscription_status = 'active' |
25 | | -end |
26 | | - |
27 | | -puts " ✅ Organization: #{org1.name} (#{org1.tier})" |
28 | | - |
29 | | -user1 = User.find_or_create_by!(email: '[email protected]') do | user| |
30 | | - user.organization = org1 |
31 | | - user.password = DEFAULT_DEV_PASSWORD |
32 | | - user.password_confirmation = DEFAULT_DEV_PASSWORD |
33 | | - user.full_name = 'Java E-sports Coach' |
34 | | - user.role = 'coach' |
35 | | - user.timezone = 'America/Sao_Paulo' |
36 | | - user.language = 'pt-BR' |
37 | | -end |
38 | | - |
39 | | -puts " ✅ User: #{user1.email} (role: #{user1.role})" |
40 | | - |
41 | | -# ============================================================================ |
42 | | -# TIME 2: BotaPagodão.net (Tier 2 Semi-Pro) |
43 | | -# ============================================================================ |
44 | | -puts "\n📍 Creating BotaPagodão.net..." |
45 | | - |
46 | | -org2 = Organization.find_or_create_by!(id: 'd2e76113-eeda-4e5c-9a5e-bd3e944fc290') do |organization| |
47 | | - organization.name = 'BotaPagodão.net' |
48 | | - organization.slug = 'botapagodao-net' |
49 | | - organization.region = 'BR' |
50 | | - organization.tier = 'tier_2_semi_pro' |
51 | | - organization.subscription_plan = 'semi_pro' |
52 | | - organization.subscription_status = 'active' |
53 | | -end |
54 | | - |
55 | | -puts " ✅ Organization: #{org2.name} (#{org2.tier})" |
56 | | - |
57 | | -user2 = User.find_or_create_by!(email: '[email protected]') do | user| |
58 | | - user.organization = org2 |
59 | | - user.password = DEFAULT_DEV_PASSWORD |
60 | | - user.password_confirmation = DEFAULT_DEV_PASSWORD |
61 | | - user.full_name = 'BotaPagodão Coach' |
62 | | - user.role = 'coach' |
63 | | - user.timezone = 'America/Sao_Paulo' |
64 | | - user.language = 'pt-BR' |
65 | | -end |
66 | | - |
67 | | -puts " ✅ User: #{user2.email} (role: #{user2.role})" |
68 | | - |
69 | | -# ============================================================================ |
70 | | -# TIME 3: Discordia (Tier 2 Semi-Pro) |
71 | | -# ============================================================================ |
72 | | -puts "\n📍 Creating Discordia..." |
73 | | - |
74 | | -org3 = Organization.find_or_create_by!(slug: 'discordia') do |organization| |
75 | | - organization.name = 'Discordia' |
76 | | - organization.region = 'BR' |
77 | | - organization.tier = 'tier_2_semi_pro' |
78 | | - organization.subscription_plan = 'semi_pro' |
79 | | - organization.subscription_status = 'active' |
80 | | -end |
81 | | - |
82 | | -puts " ✅ Organization: #{org3.name} (#{org3.tier}) - ID: #{org3.id}" |
83 | | - |
84 | | -user3 = User.find_or_create_by!(email: '[email protected]') do | user| |
85 | | - user.organization = org3 |
86 | | - user.password = DEFAULT_DEV_PASSWORD |
87 | | - user.password_confirmation = DEFAULT_DEV_PASSWORD |
88 | | - user.full_name = 'Discordia Coach' |
89 | | - user.role = 'coach' |
90 | | - user.timezone = 'America/Sao_Paulo' |
91 | | - user.language = 'pt-BR' |
92 | | -end |
93 | | - |
94 | | -puts " ✅ User: #{user3.email} (role: #{user3.role})" |
95 | | - |
96 | | -# ============================================================================ |
97 | | -# SUMMARY |
98 | | -# ============================================================================ |
99 | | -puts "\n" + ("=" * 70) |
100 | | -puts "🎉 Database seeded successfully!" |
101 | | -puts ("=" * 70) |
102 | | -puts "\n📋 Organizations Created:" |
103 | | -puts " 1. Java E-sports (Tier 1 Professional)" |
104 | | -puts " • ID: #{org1.id}" |
105 | | -puts " • Login: [email protected] / #{DEFAULT_DEV_PASSWORD}" |
106 | | -puts "" |
107 | | -puts " 2. BotaPagodão.net (Tier 2 Semi-Pro)" |
108 | | -puts " • ID: #{org2.id}" |
109 | | -puts " • Login: [email protected] / #{DEFAULT_DEV_PASSWORD}" |
110 | | -puts "" |
111 | | -puts " 3. Discordia (Tier 2 Semi-Pro)" |
112 | | -puts " • ID: #{org3.id}" |
113 | | -puts " • Login: [email protected] / #{DEFAULT_DEV_PASSWORD}" |
114 | | -puts "\n" + ("=" * 70) |
115 | | -puts "📝 Next Steps:" |
116 | | -puts " • Import players manually for each organization" |
117 | | -puts " • Verify login works with the credentials above" |
118 | | -puts "\n⚠️ IMPORTANT: These are DEVELOPMENT-ONLY credentials!" |
119 | | -puts " Never use these passwords in production environments." |
120 | | -puts ("=" * 70) + "\n" |
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +# Seeds file for ProStaff API - Development/Testing Data |
| 4 | +# |
| 5 | +# SECURITY NOTE: This file creates development-only accounts |
| 6 | +# Never use these credentials in production! |
| 7 | + |
| 8 | +# Get password from ENV or use default for development |
| 9 | +DEFAULT_DEV_PASSWORD = ENV.fetch('DEV_SEED_PASSWORD', 'password123') |
| 10 | + |
| 11 | +puts '🌱 Seeding database with organizations...' |
| 12 | + |
| 13 | +# ============================================================================ |
| 14 | +# TIME 1: Java E-sports (Tier 1 Professional) |
| 15 | +# ============================================================================ |
| 16 | +puts "\n📍 Creating Java E-sports..." |
| 17 | + |
| 18 | +org1 = Organization.find_or_create_by!(id: '043824c0-906f-4aa2-9bc7-11d668b508dc') do |organization| |
| 19 | + organization.name = 'Java E-sports' |
| 20 | + organization.slug = 'java-esports' |
| 21 | + organization.region = 'BR' |
| 22 | + organization.tier = 'tier_1_professional' |
| 23 | + organization.subscription_plan = 'professional' |
| 24 | + organization.subscription_status = 'active' |
| 25 | +end |
| 26 | + |
| 27 | +puts " ✅ Organization: #{org1.name} (#{org1.tier})" |
| 28 | + |
| 29 | +user1 = User.find_or_create_by!(email: '[email protected]') do | user| |
| 30 | + user.organization = org1 |
| 31 | + user.password = DEFAULT_DEV_PASSWORD |
| 32 | + user.password_confirmation = DEFAULT_DEV_PASSWORD |
| 33 | + user.full_name = 'Java E-sports Coach' |
| 34 | + user.role = 'coach' |
| 35 | + user.timezone = 'America/Sao_Paulo' |
| 36 | + user.language = 'pt-BR' |
| 37 | +end |
| 38 | + |
| 39 | +puts " ✅ User: #{user1.email} (role: #{user1.role})" |
| 40 | + |
| 41 | +# ============================================================================ |
| 42 | +# TIME 2: BotaPagodão.net (Tier 2 Semi-Pro) |
| 43 | +# ============================================================================ |
| 44 | +puts "\n📍 Creating BotaPagodão.net..." |
| 45 | + |
| 46 | +org2 = Organization.find_or_create_by!(id: 'd2e76113-eeda-4e5c-9a5e-bd3e944fc290') do |organization| |
| 47 | + organization.name = 'BotaPagodão.net' |
| 48 | + organization.slug = 'botapagodao-net' |
| 49 | + organization.region = 'BR' |
| 50 | + organization.tier = 'tier_2_semi_pro' |
| 51 | + organization.subscription_plan = 'semi_pro' |
| 52 | + organization.subscription_status = 'active' |
| 53 | +end |
| 54 | + |
| 55 | +puts " ✅ Organization: #{org2.name} (#{org2.tier})" |
| 56 | + |
| 57 | +user2 = User.find_or_create_by!(email: '[email protected]') do | user| |
| 58 | + user.organization = org2 |
| 59 | + user.password = DEFAULT_DEV_PASSWORD |
| 60 | + user.password_confirmation = DEFAULT_DEV_PASSWORD |
| 61 | + user.full_name = 'BotaPagodão Coach' |
| 62 | + user.role = 'coach' |
| 63 | + user.timezone = 'America/Sao_Paulo' |
| 64 | + user.language = 'pt-BR' |
| 65 | +end |
| 66 | + |
| 67 | +puts " ✅ User: #{user2.email} (role: #{user2.role})" |
| 68 | + |
| 69 | +# ============================================================================ |
| 70 | +# TIME 3: Discordia (Tier 2 Semi-Pro) |
| 71 | +# ============================================================================ |
| 72 | +puts "\n📍 Creating Discordia..." |
| 73 | + |
| 74 | +org3 = Organization.find_or_create_by!(slug: 'discordia') do |organization| |
| 75 | + organization.name = 'Discordia' |
| 76 | + organization.region = 'BR' |
| 77 | + organization.tier = 'tier_2_semi_pro' |
| 78 | + organization.subscription_plan = 'semi_pro' |
| 79 | + organization.subscription_status = 'active' |
| 80 | +end |
| 81 | + |
| 82 | +puts " ✅ Organization: #{org3.name} (#{org3.tier}) - ID: #{org3.id}" |
| 83 | + |
| 84 | +user3 = User.find_or_create_by!(email: '[email protected]') do | user| |
| 85 | + user.organization = org3 |
| 86 | + user.password = DEFAULT_DEV_PASSWORD |
| 87 | + user.password_confirmation = DEFAULT_DEV_PASSWORD |
| 88 | + user.full_name = 'Discordia Coach' |
| 89 | + user.role = 'coach' |
| 90 | + user.timezone = 'America/Sao_Paulo' |
| 91 | + user.language = 'pt-BR' |
| 92 | +end |
| 93 | + |
| 94 | +puts " ✅ User: #{user3.email} (role: #{user3.role})" |
| 95 | + |
| 96 | +# ============================================================================ |
| 97 | +# SUMMARY |
| 98 | +# ============================================================================ |
| 99 | +puts "\n" + ('=' * 70) |
| 100 | +puts '🎉 Database seeded successfully!' |
| 101 | +puts('=' * 70) |
| 102 | +puts "\n📋 Organizations Created:" |
| 103 | +puts ' 1. Java E-sports (Tier 1 Professional)' |
| 104 | +puts " • ID: #{org1.id}" |
| 105 | +puts " • Login: [email protected] / #{DEFAULT_DEV_PASSWORD}" |
| 106 | +puts '' |
| 107 | +puts ' 2. BotaPagodão.net (Tier 2 Semi-Pro)' |
| 108 | +puts " • ID: #{org2.id}" |
| 109 | +puts " • Login: [email protected] / #{DEFAULT_DEV_PASSWORD}" |
| 110 | +puts '' |
| 111 | +puts ' 3. Discordia (Tier 2 Semi-Pro)' |
| 112 | +puts " • ID: #{org3.id}" |
| 113 | +puts " • Login: [email protected] / #{DEFAULT_DEV_PASSWORD}" |
| 114 | +puts "\n" + ('=' * 70) |
| 115 | +puts '📝 Next Steps:' |
| 116 | +puts ' • Import players manually for each organization' |
| 117 | +puts ' • Verify login works with the credentials above' |
| 118 | +puts "\n⚠️ IMPORTANT: These are DEVELOPMENT-ONLY credentials!" |
| 119 | +puts ' Never use these passwords in production environments.' |
| 120 | +puts ('=' * 70) + "\n" |
0 commit comments