CustomerGroupService
internal.internal.CustomerGroupService
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>customerGroupRepository_
Repository<CustomerGroup> & { addCustomers: Method addCustomers ; findWithRelationsAndCount: Method findWithRelationsAndCount ; removeCustomers: Method removeCustomers }RequiredhandleCreationFail
anyRequiredmanager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
addCustomers
addCustomers(id
, customerIds
): Promise
<CustomerGroup
>
Add a batch of customers to a customer group at once
Parameters
id
stringRequiredcustomerIds
string | string[]RequiredReturns
Promise
<CustomerGroup
>
the customer group after insertion
atomicPhase_
Protected
atomicPhase_<TResult
, TError
>(work
, isolationOrErrorHandler?
, maybeErrorHandlerOrDontFail?
): Promise
<TResult
>
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
<TResult
>
Promise
Promise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
create
create(group
): Promise
<CustomerGroup
>
Creates a customer group with the provided data.
Parameters
Returns
Promise
<CustomerGroup
>
the result of the create operation
delete
delete(groupId
): Promise
<void
>
Remove customer group
Parameters
groupId
stringRequiredReturns
Promise
<void
>
Promise
Promise<void>Requiredlist
list(selector
, config
): Promise
<CustomerGroup
[]>
List customer groups.
Parameters
selector
undefined | Selector<CustomerGroup> & { discount_condition_id?: string ; q?: string }RequiredReturns
Promise
<CustomerGroup
[]>
the result of the find operation
listAndCount
listAndCount(selector
, config
): Promise
<[CustomerGroup
[], number
]>
Retrieve a list of customer groups and total count of records that match the query.
Parameters
selector
undefined | Selector<CustomerGroup> & { discount_condition_id?: string ; q?: string }RequiredReturns
Promise
<[CustomerGroup
[], number
]>
the result of the find operation
removeCustomer
removeCustomer(id
, customerIds
): Promise
<CustomerGroup
>
Remove list of customers from a customergroup
Parameters
id
stringRequiredcustomerIds
string | string[]RequiredReturns
Promise
<CustomerGroup
>
the customergroup with the provided id
retrieve
retrieve(customerGroupId
, config?
): Promise
<CustomerGroup
>
Parameters
customerGroupId
stringRequiredconfig
objectReturns
Promise
<CustomerGroup
>
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(customerGroupId
, update
): Promise
<CustomerGroup
>
Update a customer group.
Parameters
customerGroupId
stringRequiredReturns
Promise
<CustomerGroup
>
resulting customer group
withTransaction
withTransaction(transactionManager?
): CustomerGroupService
Parameters
transactionManager
EntityManager