CustomerGroupService
constructor
Parameters
__namedParameters
CustomerGroupConstructorPropsRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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
retrieve
Parameters
customerGroupId
stringRequiredconfig
objectRequiredDefault: {}
Returns
create
Creates a customer group with the provided data.
Parameters
the customer group to create
Returns
the result of the create operation
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
update
Update a customer group.
Parameters
customerGroupId
stringRequiredid of the customer group
update
CustomerGroupUpdateRequiredcustomer group partial data
Returns
resulting customer group
delete
Remove customer group
Parameters
groupId
stringRequiredid of the customer group to delete
Returns
Promise
Promise<void>Requireda promise
list
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
handleCreationFail
Parameters
id
stringRequiredids
string[]Requirederror
anyRequiredReturns
Promise
Promise<never>RequiredWas this section helpful?