CustomerGroupService
constructor
Parameters
__namedParametersCustomerGroupConstructorPropsRequiredProperties
__container__anyRequiredmanager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequired__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredMethods
addCustomers
Add a batch of customers to a customer group at once
Parameters
idstringRequiredid of the customer group to add customers to
customerIdsstring | 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
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Potential error handler
Returns
PromisePromise<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
groupIdstringRequiredid of the customer group to delete
Returns
PromisePromise<void>Requireda promise
handleCreationFail
Parameters
idstringRequiredidsstring[]RequirederroranyRequiredReturns
PromisePromise<never>Requiredlist
List customer groups.
Parameters
selectorobjectRequiredthe query object for find
Default: {}
the config to be used for find
selector.discount_condition_idstringselector.qstringReturns
the result of the find operation
listAndCount
Retrieve a list of customer groups and total count of records that match the query.
Parameters
selectorobjectRequiredthe query object for find
Default: {}
the config to be used for find
selector.discount_condition_idstringselector.qstringReturns
the result of the find operation
removeCustomer
Remove list of customers from a customergroup
Parameters
idstringRequiredid of the customer group from which the customers are removed
customerIdsstring | string[]Requiredid's of the customer to remove from group
Returns
the customergroup with the provided id
retrieve
Parameters
customerGroupIdstringRequiredconfigobjectRequiredDefault: {}
Returns
shouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleanRequiredupdate
Update a customer group.
Parameters
customerGroupIdstringRequiredid of the customer group
updateCustomerGroupUpdateRequiredcustomer group partial data
Returns
resulting customer group
withTransaction
Parameters
transactionManagerEntityManagerReturns
CustomerGroupServiceobjectRequiredWas this section helpful?