Class: Dscf::Banking::VirtualAccountProductsController

Inherits:
ApplicationController show all
Includes:
DemoPermissionBypass, Core::Common, Core::ReviewableController
Defined in:
app/controllers/dscf/banking/virtual_account_products_controller.rb

Instance Method Summary collapse

Methods included from DemoPermissionBypass

#bypass_permissions_for_demo?, #pundit_user

Methods inherited from ApplicationController

#bypass_permissions_for_demo?, #pundit_user

Instance Method Details

#audit_logsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/dscf/banking/virtual_account_products_controller.rb', line 29

def audit_logs
  product = Dscf::Banking::VirtualAccountProduct.find(params[:id])
  audit_logs = Dscf::Banking::ProductAuditLog.by_product(product.id).recent

  render json: {
    success: true,
    data: audit_logs.map do |log|
      {
        id: log.id,
        change_type: log.change_type,
        old_values: log.old_values,
        new_values: log.new_values,
        change_description: log.change_description,
        changed_by: {
          id: log.changed_by.id,
          name: user_full_name(log.changed_by)
        },
        created_at: log.created_at
      }
    end
  }
rescue ActiveRecord::RecordNotFound
  render json: {
    success: false,
    error: "Product not found"
  }, status: :not_found
end

#authorize_review_action!Object

TEMPORARY DEMO BYPASS: remove after demo.



25
26
27
# File 'app/controllers/dscf/banking/virtual_account_products_controller.rb', line 25

def authorize_review_action!
  skip_authorization
end