Skip to main content
Skip to main content

listAndCountAddresses - Customer Module Reference

This documentation provides a reference to the listAndCountAddresses method. This belongs to the Customer Module.

This method retrieves a paginated list of addresses along with the total count of available addresses satisfying the provided filters.

Example

To retrieve a list of addresses using their IDs:

const [addresses, count] =
await customerModuleService.listAndCountAddresses({
id: ["cuaddr_123", "cuaddr_321"],
})

To specify relations that should be retrieved within the addresses:

const [addresses, count] =
await customerModuleService.listAndCountAddresses(
{
id: ["cuaddr_123", "cuaddr_321"],
},
{
relations: ["customer"],
}
)

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

const [addresses, count] =
await customerModuleService.listAndCountAddresses(
{
id: ["cuaddr_123", "cuaddr_321"],
},
{
relations: ["customer"],
take: 20,
skip: 2,
}
)

Parameters

The filters to apply on the retrieved addresss.
The configurations determining how the address is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a address.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<[CustomerAddressDTO[], number]>Required
The list of addresses along with their total count.
Was this section helpful?