Display Dwolla customers
This example shows you how to create a smart collection to list the customers of your Dwolla account.
1. Define the smart collection
Filterable fields are flagged using isFilterable: true. You will need to enable this option using the collection settings in the Layout Editor.
Customers have isSearchable flag enabled: it means the search input field will be activated on the collection UI.
// forest/dwolla-customers.js
const { collection } = require('forest-express-sequelize');
collection('dwollaCustomers', {
isSearchable: true,
actions: [],
fields: [
{
field: 'id',
type: 'String',
},
{
field: 'firstName',
type: 'String',
},
{
field: 'lastName',
type: 'String',
},
{
field: 'fullName',
type: 'String',
get: (customer) => {
return customer.firstName + ' ' + customer.lastName;
},
},
{
field: 'type',
type: 'Enum',
enums: ['unverified', 'personal', 'business', 'receive-only'],
},
{
field: 'email',
type: 'String',
isFilterable: true,
},
{
field: 'businessName',
type: 'String',
isFilterable: true,
},
{
field: 'created', //created_at
type: 'Date',
},
{
field: 'status',
type: 'Enum',
enums: ['unverified', 'suspended', 'retry', 'document', 'verified'],
isFilterable: true,
},
{
field: 'fundingSources',
type: ['String'],
reference: 'dwollaFundingSources.id',
},
{
field: 'transfers',
type: ['String'],
reference: 'dwollaTransfers.id',
},
],
segments: [],
});2. Implement the route
The Customers routes implement the Get List and Get One, plus the smart relationships (HasMany):
Funding Sources
Transfers
These routes use the Dwolla service described in another section.
Last updated
Was this helpful?