dscf-credit 0.4.54 → 0.4.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/db/seeds.rb +81 -5
- data/lib/dscf/credit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bcd4921c638c87e3e338d719bd993f8bc85cdd6bb79dd4f851ae22af6a51b35
|
|
4
|
+
data.tar.gz: 04caed6c06626e1994fd53f3d9344fc1ddf1573a9fa2a424f6d006700a81eedb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70283c3783f0e65ca4f1855db5f019cf21b68ec5a6d80426ff84b7a38639c15ebcf1ecc04af3df0847d0def9f0675ccaf7d6dfdbbe44b948e362bf029c9a099f
|
|
7
|
+
data.tar.gz: 7dda7607f319c8e7a30786c77940d3d10c2505138e8dbe59b5dbd973ae9eb51d2a477402668f590812415431f4faa56d511af624ed3f3de9b970467e2d8faafc
|
data/db/seeds.rb
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
puts "Starting minimal DSCF Credit seed..."
|
|
2
2
|
|
|
3
|
+
puts "Seeding business types..."
|
|
4
|
+
if defined?(Dscf::Core::BusinessType)
|
|
5
|
+
wholesaler = Dscf::Core::BusinessType.find_or_create_by(name: 'wholesaler')
|
|
6
|
+
puts "✓ Business types created/found"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
puts "Registering dscf_credit permissions..."
|
|
11
|
+
if defined?(Dscf::Core::PermissionRegistry)
|
|
12
|
+
Dscf::Core::PermissionRegistry.register("dscf_credit") do
|
|
13
|
+
resource :banks, actions: %i[index show create update destroy]
|
|
14
|
+
resource :bank_branches, actions: %i[index show create update destroy]
|
|
15
|
+
resource :bank_staffs, actions: %i[index show create update destroy]
|
|
16
|
+
resource :categories, actions: %i[index show create update destroy]
|
|
17
|
+
resource :users, actions: %i[index show create update destroy]
|
|
18
|
+
resource :loans, actions: %i[index show create update destroy]
|
|
19
|
+
resource :loan_accruals, actions: %i[index show create update destroy generate statistics]
|
|
20
|
+
resource :loan_transactions, actions: %i[index show create update destroy]
|
|
21
|
+
resource :loan_application_data, actions: %i[index show create update destroy]
|
|
22
|
+
resource :loan_profiles, actions: %i[index show create update destroy submit approve reject request_modification resubmit calculate_facility_limits]
|
|
23
|
+
resource :loan_applications, actions: %i[index show create update destroy submit approve reject request_modification resubmit submit_source_data scoring_form calculate_credit_score]
|
|
24
|
+
resource :facilitators, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
|
|
25
|
+
resource :facilitator_applications, actions: %i[index show create update destroy submit approve reject request_modification resubmit bulk_create]
|
|
26
|
+
resource :scoring_tables, actions: %i[index show create update destroy submit approve reject request_modification resubmit activate deactivate]
|
|
27
|
+
resource :scoring_parameters, actions: %i[index show create update destroy submit approve reject request_modification resubmit activate deactivate]
|
|
28
|
+
resource :scoring_table_parameters, actions: %i[index show create update destroy]
|
|
29
|
+
resource :scoring_table_normalizers, actions: %i[index show create update destroy]
|
|
30
|
+
resource :information_sources, actions: %i[index show create update destroy submit approve reject request_modification resubmit activate deactivate]
|
|
31
|
+
resource :credit_products, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
|
|
32
|
+
resource :credit_lines, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
|
|
33
|
+
resource :credit_line_specs, actions: %i[index show create update destroy]
|
|
34
|
+
resource :eligible_credit_lines, actions: %i[index show create update destroy apply_risk]
|
|
35
|
+
resource :system_configs, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
|
|
36
|
+
resource :system_config_definitions, actions: %i[index show create update destroy]
|
|
37
|
+
resource :credit_limit_calculations, actions: %i[create]
|
|
38
|
+
resource :disbursements, actions: %i[create]
|
|
39
|
+
resource :repayments, actions: %i[create]
|
|
40
|
+
resource :kyc_reviews, actions: %i[index show]
|
|
41
|
+
end
|
|
42
|
+
puts "✓ dscf_credit permissions registered"
|
|
43
|
+
end
|
|
44
|
+
|
|
3
45
|
admin_user = nil
|
|
4
46
|
admin_role = nil
|
|
5
47
|
|
|
@@ -16,15 +58,25 @@ else
|
|
|
16
58
|
end
|
|
17
59
|
|
|
18
60
|
if defined?(Dscf::Core::Role)
|
|
19
|
-
|
|
20
|
-
role.name = '
|
|
61
|
+
super_admin_role = Dscf::Core::Role.find_or_create_by(code: 'SUPER_ADMIN') do |role|
|
|
62
|
+
role.name = 'Super Administrator'
|
|
63
|
+
role.description = 'Full system access — bypasses all permission checks'
|
|
64
|
+
role.active = true
|
|
21
65
|
end
|
|
22
66
|
puts "✓ System admin role created/found"
|
|
23
67
|
end
|
|
24
68
|
|
|
25
|
-
if
|
|
26
|
-
Dscf::Core::
|
|
27
|
-
|
|
69
|
+
if defined?(Dscf::Core::Permission) && defined?(Dscf::Core::RolePermission)
|
|
70
|
+
all_credit_permissions = Dscf::Core::Permission.where(engine: 'dscf_credit').pluck(:code)
|
|
71
|
+
# SUPER_ADMIN gets all permissions
|
|
72
|
+
Dscf::Core::Permission.where(code: all_credit_permissions).each do |perm|
|
|
73
|
+
Dscf::Core::RolePermission.find_or_create_by!(role: super_admin_role, permission: perm)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
if admin_user && super_admin_role && defined?(Dscf::Core::UserRole)
|
|
78
|
+
Dscf::Core::UserRole.find_or_create_by!(user: admin_user, role: super_admin_role)
|
|
79
|
+
puts "✓ Super admin role assigned to admin user"
|
|
28
80
|
end
|
|
29
81
|
|
|
30
82
|
bunna_bank = Dscf::Credit::Bank.find_or_create_by!(registration_number: 'BUN001') do |bank|
|
|
@@ -38,5 +90,29 @@ bunna_bank = Dscf::Credit::Bank.find_or_create_by!(registration_number: 'BUN001'
|
|
|
38
90
|
bank.status = 'active'
|
|
39
91
|
end
|
|
40
92
|
|
|
93
|
+
bunna_head_office = Dscf::Credit::BankBranch.find_or_create_by(bank: bunna_bank, branch_name: 'Head Office') do |branch|
|
|
94
|
+
branch.branch_code = 'BUN-HO-001'
|
|
95
|
+
branch.branch_address = 'Churchill Avenue, Addis Ababa'
|
|
96
|
+
branch.city = 'Addis Ababa'
|
|
97
|
+
branch.country = 'Ethiopia'
|
|
98
|
+
branch.contact_email = 'headoffice@bunnabank.com'
|
|
99
|
+
branch.contact_phone = '+251115510001'
|
|
100
|
+
branch.status = 'active'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if defined?(Dscf::Core::Business) && defined?(Dscf::Core::BusinessType)
|
|
104
|
+
business1 = Dscf::Core::Business.find_or_create_by(
|
|
105
|
+
user_id: admin_user.id,
|
|
106
|
+
business_type_id: wholesaler.id
|
|
107
|
+
) do |business|
|
|
108
|
+
business.name = 'Individual Trading Business'
|
|
109
|
+
business.description = 'Individual business for trading services'
|
|
110
|
+
business.contact_email = admin_user.email
|
|
111
|
+
business.contact_phone = admin_user.phone
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
puts "✓ Businesses created/found"
|
|
115
|
+
end
|
|
116
|
+
|
|
41
117
|
puts "✓ Bank created/found: #{bunna_bank.name}"
|
|
42
118
|
puts "Minimal seed completed successfully."
|
data/lib/dscf/credit/version.rb
CHANGED