CustomerGroupService
constructor
Parameters
__namedParameters
CustomerGroupConstructorPropsRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
addCustomers
Add a batch of customers to a customer group at once
Parameters
id
stringRequiredid of the customer group to add customers to
customerIds
string | string[]Requiredcustomer id's to add to the group
Returns
the customer group after insertion
atomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<TResult>Requiredthe result of the transactional work
create
Creates a customer group with the provided data.
Parameters
the customer group to create
Returns
the result of the create operation
delete
Remove customer group
Parameters
groupId
stringRequiredid of the customer group to delete
Returns
Promise
Promise<void>Requireda promise
handleCreationFail
Parameters
id
stringRequiredids
string[]Requirederror
anyRequiredReturns
Promise
Promise<never>Requiredlist
List customer groups.
Parameters
the query object for find
Default: {}
the config to be used for find
Returns
the result of the find operation
listAndCount
Retrieve a list of customer groups and total count of records that match the query.
Parameters
the query object for find
Default: {}
the config to be used for find
Returns
the result of the find operation
removeCustomer
Remove list of customers from a customergroup
Parameters
id
stringRequiredid of the customer group from which the customers are removed
customerIds
string | string[]Requiredid's of the customer to remove from group
Returns
the customergroup with the provided id
retrieve
Parameters
customerGroupId
stringRequiredconfig
objectRequiredDefault: {}
Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanupdate
Update a customer group.
Parameters
customerGroupId
stringRequiredid of the customer group
update
CustomerGroupUpdateRequiredcustomer group partial data
Returns
resulting customer group
withTransaction
Parameters
transactionManager
EntityManagerReturns
CustomerGroupService
objectRequiredWas this section helpful?