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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 664b2af8bd89a05c8241bac8799263916a3c61f9670daa9f3af64f1cbb3af8c5
4
- data.tar.gz: d7b27f18e57c8073ee3c0cfa0a3b32e3e5676f6b6aac522beef897855c14b926
3
+ metadata.gz: 4bcd4921c638c87e3e338d719bd993f8bc85cdd6bb79dd4f851ae22af6a51b35
4
+ data.tar.gz: 04caed6c06626e1994fd53f3d9344fc1ddf1573a9fa2a424f6d006700a81eedb
5
5
  SHA512:
6
- metadata.gz: 3942f65c54066fc02898260c4975169c684969e92b7e4744ddfabda5dc66850e6b2542bcfca562c45005148b717dc81441738e846d164db7136474870d2d93f0
7
- data.tar.gz: c30e3b5c3cd0d5e51c8d86be44294c00d864da7bf418794bba8152a2db054101bcc6c77d07865a6678ef254a0431540ef0093824f32c6d96a63d9a864c3c91be
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
- admin_role = Dscf::Core::Role.find_or_create_by!(code: 'admin') do |role|
20
- role.name = 'System Administrator'
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 admin_user && admin_role && defined?(Dscf::Core::UserRole)
26
- Dscf::Core::UserRole.find_or_create_by!(user: admin_user, role: admin_role)
27
- puts "✓ Admin role assigned to admin user"
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."
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Credit
3
- VERSION = "0.4.54"
3
+ VERSION = "0.4.56"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-credit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.54
4
+ version: 0.4.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adoniyas