dscf-credit 0.1.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/controllers/dscf/credit/application_controller.rb +8 -0
- data/app/controllers/dscf/credit/bank_branches_controller.rb +38 -0
- data/app/controllers/dscf/credit/bank_staffs_controller.rb +77 -0
- data/app/controllers/dscf/credit/banks_controller.rb +39 -0
- data/app/controllers/dscf/credit/categories_controller.rb +32 -0
- data/app/controllers/dscf/credit/credit_line_specs_controller.rb +72 -0
- data/app/controllers/dscf/credit/credit_lines_controller.rb +76 -0
- data/app/controllers/dscf/credit/facilitators_controller.rb +227 -0
- data/app/controllers/dscf/credit/loans_controller.rb +41 -0
- data/app/controllers/dscf/credit/parameter_normalizers_controller.rb +31 -0
- data/app/controllers/dscf/credit/payment_requests_controller.rb +38 -0
- data/app/controllers/dscf/credit/payments_controller.rb +36 -0
- data/app/controllers/dscf/credit/scoring_parameters_controller.rb +50 -0
- data/app/controllers/dscf/credit/scoring_tables_controller.rb +63 -0
- data/app/controllers/dscf/credit/system_config_definitions_controller.rb +34 -0
- data/app/controllers/dscf/credit/system_configs_controller.rb +49 -0
- data/app/controllers/dscf/credit/users_controller.rb +53 -0
- data/app/jobs/dscf/credit/application_job.rb +6 -0
- data/app/mailers/dscf/credit/application_mailer.rb +8 -0
- data/app/mailers/dscf/credit/bank_staff_welcome_mailer.rb +15 -0
- data/app/mailers/dscf/credit/facilitator_mailer.rb +54 -0
- data/app/models/dscf/credit/accounting_audit_request.rb +17 -0
- data/app/models/dscf/credit/accounting_entry.rb +15 -0
- data/app/models/dscf/credit/application_record.rb +7 -0
- data/app/models/dscf/credit/bank.rb +38 -0
- data/app/models/dscf/credit/bank_branch.rb +23 -0
- data/app/models/dscf/credit/bank_staff.rb +26 -0
- data/app/models/dscf/credit/category.rb +21 -0
- data/app/models/dscf/credit/credit_line.rb +30 -0
- data/app/models/dscf/credit/credit_line_spec.rb +37 -0
- data/app/models/dscf/credit/daily_routine_transaction.rb +18 -0
- data/app/models/dscf/credit/facilitator.rb +31 -0
- data/app/models/dscf/credit/facilitator_performance.rb +17 -0
- data/app/models/dscf/credit/failed_operations_log.rb +17 -0
- data/app/models/dscf/credit/loan.rb +33 -0
- data/app/models/dscf/credit/loan_profile.rb +43 -0
- data/app/models/dscf/credit/loan_profile_scoring_spec.rb +23 -0
- data/app/models/dscf/credit/loan_transaction.rb +17 -0
- data/app/models/dscf/credit/parameter_normalizer.rb +11 -0
- data/app/models/dscf/credit/payment.rb +22 -0
- data/app/models/dscf/credit/payment_request.rb +29 -0
- data/app/models/dscf/credit/scoring_parameter.rb +30 -0
- data/app/models/dscf/credit/scoring_table.rb +24 -0
- data/app/models/dscf/credit/system_config.rb +25 -0
- data/app/models/dscf/credit/system_config_definition.rb +25 -0
- data/app/serializers/dscf/core/business_serializer.rb +9 -0
- data/app/serializers/dscf/core/business_type_serializer.rb +7 -0
- data/app/serializers/dscf/core/role_serializer.rb +7 -0
- data/app/serializers/dscf/core/user_profile_serializer.rb +13 -0
- data/app/serializers/dscf/core/user_role_serializer.rb +16 -0
- data/app/serializers/dscf/core/user_serializer.rb +17 -0
- data/app/serializers/dscf/credit/bank_branch_serializer.rb +9 -0
- data/app/serializers/dscf/credit/bank_serializer.rb +9 -0
- data/app/serializers/dscf/credit/bank_staff_serializer.rb +8 -0
- data/app/serializers/dscf/credit/category_serializer.rb +7 -0
- data/app/serializers/dscf/credit/credit_line_serializer.rb +12 -0
- data/app/serializers/dscf/credit/credit_line_spec_serializer.rb +12 -0
- data/app/serializers/dscf/credit/parameter_normalizer_serializer.rb +8 -0
- data/app/serializers/dscf/credit/scoring_parameter_serializer.rb +12 -0
- data/app/serializers/dscf/credit/scoring_table_serializer.rb +9 -0
- data/app/serializers/dscf/credit/system_config_definition_serializer.rb +9 -0
- data/app/serializers/dscf/credit/system_config_serializer.rb +18 -0
- data/app/services/dscf/credit/bank_staff_creation_service.rb +99 -0
- data/app/services/dscf/credit/facilitator_additional_info_service.rb +62 -0
- data/app/services/dscf/credit/facilitator_approval_service.rb +88 -0
- data/app/views/dscf/credit/bank_staff_welcome_mailer/welcome_email.html.erb +116 -0
- data/app/views/dscf/credit/bank_staff_welcome_mailer/welcome_email.text.erb +40 -0
- data/app/views/dscf/credit/facilitator_mailer/additional_info_received.html.erb +39 -0
- data/app/views/dscf/credit/facilitator_mailer/additional_info_received.text.erb +17 -0
- data/app/views/dscf/credit/facilitator_mailer/approval_notification.html.erb +59 -0
- data/app/views/dscf/credit/facilitator_mailer/approval_notification.text.erb +26 -0
- data/app/views/dscf/credit/facilitator_mailer/limit_update_notification.html.erb +39 -0
- data/app/views/dscf/credit/facilitator_mailer/limit_update_notification.text.erb +17 -0
- data/app/views/dscf/credit/facilitator_mailer/rejection_notification.html.erb +41 -0
- data/app/views/dscf/credit/facilitator_mailer/rejection_notification.text.erb +19 -0
- data/app/views/layouts/mailer.html.erb +125 -0
- data/app/views/layouts/mailer.text.erb +12 -0
- data/config/locales/en.yml +208 -0
- data/config/routes.rb +50 -0
- data/db/migrate/20250822091011_create_dscf_credit_categories.rb +15 -0
- data/db/migrate/20250822091015_create_dscf_credit_banks.rb +23 -0
- data/db/migrate/20250822091055_create_dscf_credit_bank_branches.rb +23 -0
- data/db/migrate/20250822091131_create_dscf_credit_credit_lines.rb +25 -0
- data/db/migrate/20250822091527_create_dscf_credit_credit_line_specs.rb +32 -0
- data/db/migrate/20250822091744_create_dscf_credit_system_config_definitions.rb +18 -0
- data/db/migrate/20250822091820_create_dscf_credit_system_configs.rb +17 -0
- data/db/migrate/20250822092050_create_dscf_credit_scoring_parameters.rb +30 -0
- data/db/migrate/20250822092225_create_dscf_credit_parameter_normalizers.rb +18 -0
- data/db/migrate/20250822092246_create_dscf_credit_loan_profiles.rb +25 -0
- data/db/migrate/20250822092417_create_dscf_credit_loan_profile_scoring_specs.rb +23 -0
- data/db/migrate/20250822092436_create_dscf_credit_facilitators.rb +22 -0
- data/db/migrate/20250822092528_create_dscf_credit_facilitator_performances.rb +26 -0
- data/db/migrate/20250822092608_create_dscf_credit_payment_requests.rb +26 -0
- data/db/migrate/20250822092654_create_dscf_credit_loans.rb +29 -0
- data/db/migrate/20250822092717_create_dscf_credit_loan_transactions.rb +21 -0
- data/db/migrate/20250822092738_create_dscf_credit_daily_routine_transactions.rb +23 -0
- data/db/migrate/20250822092819_create_dscf_credit_accounting_audit_requests.rb +20 -0
- data/db/migrate/20250822092843_create_dscf_credit_payments.rb +23 -0
- data/db/migrate/20250822092908_create_dscf_credit_failed_operations_logs.rb +21 -0
- data/db/migrate/20250822092936_create_dscf_credit_accounting_entries.rb +21 -0
- data/db/migrate/20250825231109_create_dscf_credit_bank_staff.rb +14 -0
- data/db/migrate/20250901172842_create_dscf_credit_scoring_tables.rb +18 -0
- data/db/seeds.rb +745 -0
- data/lib/dscf/credit/engine.rb +28 -0
- data/lib/dscf/credit/version.rb +5 -0
- data/lib/dscf/credit.rb +9 -0
- data/lib/tasks/dscf/credit_tasks.rake +4 -0
- data/spec/factories/dscf/credit/accounting_audit_requests.rb +58 -0
- data/spec/factories/dscf/credit/accounting_entries.rb +29 -0
- data/spec/factories/dscf/credit/bank_branches.rb +21 -0
- data/spec/factories/dscf/credit/bank_staffs.rb +19 -0
- data/spec/factories/dscf/credit/banks.rb +30 -0
- data/spec/factories/dscf/credit/categories.rb +27 -0
- data/spec/factories/dscf/credit/credit_line_specs.rb +57 -0
- data/spec/factories/dscf/credit/credit_lines.rb +32 -0
- data/spec/factories/dscf/credit/daily_routine_transactions.rb +36 -0
- data/spec/factories/dscf/credit/facilitator_performances.rb +30 -0
- data/spec/factories/dscf/credit/facilitators.rb +35 -0
- data/spec/factories/dscf/credit/failed_operations_logs.rb +34 -0
- data/spec/factories/dscf/credit/loan_profile_scoring_specs.rb +31 -0
- data/spec/factories/dscf/credit/loan_profiles.rb +49 -0
- data/spec/factories/dscf/credit/loan_transactions.rb +37 -0
- data/spec/factories/dscf/credit/loans.rb +37 -0
- data/spec/factories/dscf/credit/parameter_normalizers.rb +24 -0
- data/spec/factories/dscf/credit/payment_requests.rb +40 -0
- data/spec/factories/dscf/credit/payments.rb +39 -0
- data/spec/factories/dscf/credit/scoring_parameters.rb +48 -0
- data/spec/factories/dscf/credit/scoring_tables.rb +25 -0
- data/spec/factories/dscf/credit/system_config_definitions.rb +45 -0
- data/spec/factories/dscf/credit/system_configs.rb +29 -0
- metadata +456 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateDscfCreditFacilitators < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_facilitators do |t|
|
4
|
+
t.references :user, null: false, foreign_key: { to_table: :dscf_core_users }
|
5
|
+
t.references :bank, null: false, foreign_key: { to_table: :dscf_credit_banks }
|
6
|
+
t.string :name, null: false
|
7
|
+
t.string :type, null: false
|
8
|
+
t.decimal :total_limit, precision: 15, scale: 2
|
9
|
+
t.string :kyc_status, default: 'pending'
|
10
|
+
t.references :kyc_approved_by, polymorphic: true, null: false
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :dscf_credit_facilitators, :name
|
16
|
+
add_index :dscf_credit_facilitators, :type
|
17
|
+
add_index :dscf_credit_facilitators, :kyc_status
|
18
|
+
add_index :dscf_credit_facilitators, [ :kyc_approved_by_type, :kyc_approved_by_id ]
|
19
|
+
add_index :dscf_credit_facilitators, [ :bank_id, :user_id ], unique: true
|
20
|
+
add_index :dscf_credit_facilitators, [ :user_id, :kyc_status ]
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateDscfCreditFacilitatorPerformances < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_facilitator_performances do |t|
|
4
|
+
t.references :facilitator, null: false, foreign_key: { to_table: :dscf_credit_facilitators }
|
5
|
+
t.decimal :score, precision: 5, scale: 2
|
6
|
+
t.integer :total_outstanding_loans, default: 0
|
7
|
+
t.decimal :total_outstanding_amount, precision: 15, scale: 2, default: 0
|
8
|
+
t.boolean :approval_required, default: false
|
9
|
+
t.integer :previous_performance_id
|
10
|
+
t.jsonb :input_data
|
11
|
+
t.references :created_by, polymorphic: true, null: false
|
12
|
+
t.datetime :expires_at
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :dscf_credit_facilitator_performances, :score
|
18
|
+
add_index :dscf_credit_facilitator_performances, :total_outstanding_loans
|
19
|
+
add_index :dscf_credit_facilitator_performances, :total_outstanding_amount
|
20
|
+
add_index :dscf_credit_facilitator_performances, :approval_required
|
21
|
+
add_index :dscf_credit_facilitator_performances, [ :created_by_type, :created_by_id ]
|
22
|
+
add_index :dscf_credit_facilitator_performances, :expires_at
|
23
|
+
add_index :dscf_credit_facilitator_performances, :input_data, using: :gin
|
24
|
+
add_index :dscf_credit_facilitator_performances, [ :facilitator_id, :expires_at ]
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateDscfCreditPaymentRequests < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_payment_requests do |t|
|
4
|
+
t.references :user, null: false, foreign_key: { to_table: :dscf_core_users }
|
5
|
+
t.string :order_id, null: false
|
6
|
+
t.string :request_type, null: false
|
7
|
+
t.decimal :amount, precision: 15, scale: 2, null: false
|
8
|
+
t.string :receiver_account_reference, null: false
|
9
|
+
t.string :status, default: 'pending'
|
10
|
+
t.text :failure_reason
|
11
|
+
t.datetime :initiated_at
|
12
|
+
t.datetime :approved_at
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :dscf_credit_payment_requests, :order_id, unique: true
|
18
|
+
add_index :dscf_credit_payment_requests, :request_type
|
19
|
+
add_index :dscf_credit_payment_requests, :status
|
20
|
+
add_index :dscf_credit_payment_requests, :receiver_account_reference
|
21
|
+
add_index :dscf_credit_payment_requests, :initiated_at
|
22
|
+
add_index :dscf_credit_payment_requests, :approved_at
|
23
|
+
add_index :dscf_credit_payment_requests, [ :user_id, :status ]
|
24
|
+
add_index :dscf_credit_payment_requests, [ :user_id, :request_type ]
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class CreateDscfCreditLoans < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_loans do |t|
|
4
|
+
t.references :loan_profile, null: false, foreign_key: { to_table: :dscf_credit_loan_profiles }
|
5
|
+
t.references :credit_line, null: false, foreign_key: { to_table: :dscf_credit_credit_lines }
|
6
|
+
t.references :payment_request, null: false, foreign_key: { to_table: :dscf_credit_payment_requests }
|
7
|
+
t.string :status, default: 'pending'
|
8
|
+
t.decimal :principal_amount, precision: 15, scale: 2, null: false
|
9
|
+
t.decimal :accrued_interest, precision: 15, scale: 2, default: 0
|
10
|
+
t.decimal :accrued_penalty, precision: 15, scale: 2, default: 0
|
11
|
+
t.decimal :facilitation_fee, precision: 15, scale: 2, default: 0
|
12
|
+
t.decimal :total_loan_amount, precision: 15, scale: 2, null: false
|
13
|
+
t.decimal :remaining_amount, precision: 15, scale: 2, null: false
|
14
|
+
t.date :due_date, null: false
|
15
|
+
t.datetime :disbursed_at
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
add_index :dscf_credit_loans, :status
|
21
|
+
add_index :dscf_credit_loans, :due_date
|
22
|
+
add_index :dscf_credit_loans, :disbursed_at
|
23
|
+
add_index :dscf_credit_loans, :principal_amount
|
24
|
+
add_index :dscf_credit_loans, :remaining_amount
|
25
|
+
add_index :dscf_credit_loans, [ :loan_profile_id, :status ]
|
26
|
+
add_index :dscf_credit_loans, [ :credit_line_id, :status ]
|
27
|
+
add_index :dscf_credit_loans, [ :status, :due_date ]
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDscfCreditLoanTransactions < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_loan_transactions do |t|
|
4
|
+
t.references :loan, null: false, foreign_key: { to_table: :dscf_credit_loans }
|
5
|
+
t.string :transaction_type, null: false
|
6
|
+
t.decimal :amount, precision: 15, scale: 2, null: false
|
7
|
+
t.string :transaction_reference, null: false
|
8
|
+
t.string :status, default: 'pending'
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_loan_transactions, :transaction_type
|
14
|
+
add_index :dscf_credit_loan_transactions, :transaction_reference, unique: true
|
15
|
+
add_index :dscf_credit_loan_transactions, :status
|
16
|
+
add_index :dscf_credit_loan_transactions, :amount
|
17
|
+
add_index :dscf_credit_loan_transactions, [ :loan_id, :transaction_type ]
|
18
|
+
add_index :dscf_credit_loan_transactions, [ :loan_id, :status ]
|
19
|
+
add_index :dscf_credit_loan_transactions, :created_at
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateDscfCreditDailyRoutineTransactions < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_daily_routine_transactions do |t|
|
4
|
+
t.references :loan, null: false, foreign_key: { to_table: :dscf_credit_loans }
|
5
|
+
t.string :routine_type, null: false
|
6
|
+
t.decimal :amount, precision: 15, scale: 2, null: false
|
7
|
+
t.string :status, default: 'pending'
|
8
|
+
t.text :failure_reason
|
9
|
+
t.datetime :initiated_at
|
10
|
+
t.datetime :approved_at
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :dscf_credit_daily_routine_transactions, :routine_type
|
16
|
+
add_index :dscf_credit_daily_routine_transactions, :status
|
17
|
+
add_index :dscf_credit_daily_routine_transactions, :initiated_at
|
18
|
+
add_index :dscf_credit_daily_routine_transactions, :approved_at
|
19
|
+
add_index :dscf_credit_daily_routine_transactions, [ :loan_id, :routine_type ]
|
20
|
+
add_index :dscf_credit_daily_routine_transactions, [ :loan_id, :status ]
|
21
|
+
add_index :dscf_credit_daily_routine_transactions, [ :routine_type, :status ]
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateDscfCreditAccountingAuditRequests < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_accounting_audit_requests do |t|
|
4
|
+
t.references :source_entity, polymorphic: true, null: false
|
5
|
+
t.string :transaction_type, null: false
|
6
|
+
t.decimal :amount, precision: 15, scale: 2, null: false
|
7
|
+
t.string :webhook_key, null: false
|
8
|
+
t.string :status, default: 'pending'
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_accounting_audit_requests, [ :source_entity_type, :source_entity_id ]
|
14
|
+
add_index :dscf_credit_accounting_audit_requests, :transaction_type
|
15
|
+
add_index :dscf_credit_accounting_audit_requests, :webhook_key, unique: true
|
16
|
+
add_index :dscf_credit_accounting_audit_requests, :status
|
17
|
+
add_index :dscf_credit_accounting_audit_requests, :amount
|
18
|
+
add_index :dscf_credit_accounting_audit_requests, :created_at
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateDscfCreditPayments < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_payments do |t|
|
4
|
+
t.references :payment_request, null: false, foreign_key: { to_table: :dscf_credit_payment_requests }
|
5
|
+
t.decimal :amount, precision: 15, scale: 2, null: false
|
6
|
+
t.string :receiver_account_reference, null: false
|
7
|
+
t.string :transaction_reference, null: false
|
8
|
+
t.string :status, default: 'pending'
|
9
|
+
t.text :failure_reason
|
10
|
+
t.datetime :processed_at
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :dscf_credit_payments, :transaction_reference, unique: true
|
16
|
+
add_index :dscf_credit_payments, :receiver_account_reference
|
17
|
+
add_index :dscf_credit_payments, :status
|
18
|
+
add_index :dscf_credit_payments, :amount
|
19
|
+
add_index :dscf_credit_payments, :processed_at
|
20
|
+
add_index :dscf_credit_payments, [ :payment_request_id, :status ]
|
21
|
+
add_index :dscf_credit_payments, :created_at
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDscfCreditFailedOperationsLogs < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_failed_operations_logs do |t|
|
4
|
+
t.references :entity, polymorphic: true, null: false
|
5
|
+
t.string :failure_type, null: false
|
6
|
+
t.text :reason, null: false
|
7
|
+
t.integer :retry_count, default: 0
|
8
|
+
t.boolean :resolved, default: false
|
9
|
+
t.datetime :resolved_at
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :dscf_credit_failed_operations_logs, :failure_type
|
15
|
+
add_index :dscf_credit_failed_operations_logs, :resolved
|
16
|
+
add_index :dscf_credit_failed_operations_logs, :retry_count
|
17
|
+
add_index :dscf_credit_failed_operations_logs, :resolved_at
|
18
|
+
add_index :dscf_credit_failed_operations_logs, :created_at
|
19
|
+
add_index :dscf_credit_failed_operations_logs, [ :resolved, :failure_type ]
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateDscfCreditAccountingEntries < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_accounting_entries do |t|
|
4
|
+
t.references :audit_request, null: false, foreign_key: { to_table: :dscf_credit_accounting_audit_requests }
|
5
|
+
t.string :account_code, null: false
|
6
|
+
t.string :entry_type, null: false
|
7
|
+
t.decimal :amount, precision: 15, scale: 2, null: false
|
8
|
+
t.string :status, default: 'pending'
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_accounting_entries, :account_code
|
14
|
+
add_index :dscf_credit_accounting_entries, :entry_type
|
15
|
+
add_index :dscf_credit_accounting_entries, :status
|
16
|
+
add_index :dscf_credit_accounting_entries, :amount
|
17
|
+
add_index :dscf_credit_accounting_entries, [ :audit_request_id, :entry_type ]
|
18
|
+
add_index :dscf_credit_accounting_entries, [ :account_code, :entry_type ]
|
19
|
+
add_index :dscf_credit_accounting_entries, :created_at
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateDscfCreditBankStaff < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_bank_staffs do |t|
|
4
|
+
t.references :user, null: false, foreign_key: { to_table: :dscf_core_users }, index: true
|
5
|
+
t.references :bank_branch, null: false, foreign_key: { to_table: :dscf_credit_bank_branches }, index: true
|
6
|
+
t.string :status, default: 'active'
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :dscf_credit_bank_staffs, :status
|
12
|
+
add_index :dscf_credit_bank_staffs, [ :user_id, :bank_branch_id ], unique: true
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateDscfCreditScoringTables < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_scoring_tables do |t|
|
4
|
+
t.references :credit_line, null: false, foreign_key: { to_table: :dscf_credit_credit_lines }
|
5
|
+
t.references :scoring_parameter, null: false, foreign_key: { to_table: :dscf_credit_scoring_parameters }
|
6
|
+
t.decimal :weight, precision: 5, scale: 4, null: false
|
7
|
+
t.boolean :active, default: true
|
8
|
+
t.references :created_by, polymorphic: true, null: false
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_scoring_tables, :weight
|
14
|
+
add_index :dscf_credit_scoring_tables, :active
|
15
|
+
add_index :dscf_credit_scoring_tables, [ :created_by_type, :created_by_id ]
|
16
|
+
add_index :dscf_credit_scoring_tables, [ :credit_line_id, :scoring_parameter_id ], unique: true, name: 'index_scoring_tables_on_credit_line_and_scoring_parameter'
|
17
|
+
end
|
18
|
+
end
|