Skip to main content
Skip to main content

CustomerGroupService

constructor

Parameters

__namedParametersCustomerGroupConstructorPropsRequired

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
customerGroupRepository_Repository<CustomerGroup> & objectRequired
customerService_CustomerServiceRequired
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

addCustomers

Add a batch of customers to a customer group at once

Parameters

idstringRequired
id of the customer group to add customers to
customerIdsstring | string[]Required
customer id's to add to the group

Returns

PromisePromise<CustomerGroup>Required
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

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the 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>Required
the result of the transactional work

create

Creates a customer group with the provided data.

Parameters

groupDeepPartial<CustomerGroup>Required
the customer group to create

Returns

PromisePromise<CustomerGroup>Required
the result of the create operation

delete

Remove customer group

Parameters

groupIdstringRequired
id of the customer group to delete

Returns

PromisePromise<void>Required
a promise

handleCreationFail

Parameters

idstringRequired
idsstring[]Required
erroranyRequired

Returns

PromisePromise<never>Required

list

List customer groups.

Parameters

selectorSelector<CustomerGroup> & objectRequired
the query object for find

Default: {}

configFindConfig<CustomerGroup>Required
the config to be used for find

Returns

PromisePromise<CustomerGroup[]>Required
the result of the find operation

listAndCount

Retrieve a list of customer groups and total count of records that match the query.

Parameters

selectorSelector<CustomerGroup> & objectRequired
the query object for find

Default: {}

configFindConfig<CustomerGroup>Required
the config to be used for find

Returns

PromisePromise<[CustomerGroup[], number]>Required
the result of the find operation

removeCustomer

Remove list of customers from a customergroup

Parameters

idstringRequired
id of the customer group from which the customers are removed
customerIdsstring | string[]Required
id's of the customer to remove from group

Returns

PromisePromise<CustomerGroup>Required
the customergroup with the provided id

retrieve

Parameters

customerGroupIdstringRequired
configobjectRequired

Default: {}

Returns

PromisePromise<CustomerGroup>Required

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanboolean

update

Update a customer group.

Parameters

customerGroupIdstringRequired
id of the customer group
updateCustomerGroupUpdateRequired
customer group partial data

Returns

PromisePromise<CustomerGroup>Required
resulting customer group

withTransaction

Parameters

transactionManagerEntityManager

Returns

CustomerGroupServiceobjectRequired
Was this section helpful?