Class: ForestAdminDatasourceMambuPayments::Plugins::DisableSearch

Inherits:
ForestAdminDatasourceCustomizer::Plugins::Plugin
  • Object
show all
Defined in:
lib/forest_admin_datasource_mambu_payments/plugins/disable_search.rb

Overview

Numeral’s list endpoints have no free-text search. Forest emulates search by OR-ing a condition over every searchable column, which the ConditionTreeTranslator deliberately rejects (it cannot push an OR to Numeral) — so an operator typing in the search bar would get an error.

This plugin turns the search bar off on every Mambu collection, which is the honest behaviour: the API can filter (per ‘api_filters`) but not search. Install it once at the datasource level:

@agent.use(ForestAdminDatasourceMambuPayments::Plugins::DisableSearch, {})

Constant Summary collapse

COLLECTIONS =
%w[
  MambuConnectedAccount MambuPaymentOrder MambuTransaction MambuBalance
  MambuAccountHolder MambuExternalAccount MambuInternalAccount
  MambuIncomingPayment MambuDirectDebitMandate MambuExpectedPayment
  MambuEvent MambuFile MambuReturn MambuClaim MambuReconciliation
  MambuPaymentCapture MambuPayeeVerificationRequest
].freeze

Instance Method Summary collapse

Instance Method Details

#run(datasource_customizer, _collection_customizer = nil, _options = {}) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/forest_admin_datasource_mambu_payments/plugins/disable_search.rb', line 22

def run(datasource_customizer, _collection_customizer = nil, _options = {})
  Helpers.require_datasource!(datasource_customizer, self.class)

  COLLECTIONS.each do |name|
    datasource_customizer.customize_collection(name, &:disable_search)
  end
end