Skip to main content
Skip to main content

SalesChannelLocationService

Service for managing the stock locations of sales channels

Constructors

constructor

**new SalesChannelLocationService**(«destructured»)

Parameters

__namedParametersInjectedDependenciesRequired

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
eventBusService_IEventBusServiceRequired
manager_EntityManagerRequired
salesChannelService_SalesChannelServiceRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Protected get**activeManager_**(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

stockLocationService_

Protected get**stockLocationService_**(): [IStockLocationService](/references/services/interfaces/IStockLocationService)

Returns

IStockLocationService

create(input: CreateStockLocationInput, context?: SharedContext) => Promise<StockLocationDTO>Required
delete(id: string, context?: SharedContext) => Promise<void>Required
list(selector: FilterableStockLocationProps, config?: FindConfig<StockLocationDTO>, context?: SharedContext) => Promise<StockLocationDTO[]>Required
listAndCount(selector: FilterableStockLocationProps, config?: FindConfig<StockLocationDTO>, context?: SharedContext) => Promise<[StockLocationDTO[], number]>Required
retrieve(id: string, config?: FindConfig<StockLocationDTO>, context?: SharedContext) => Promise<StockLocationDTO>Required
update(id: string, input: UpdateStockLocationInput, context?: SharedContext) => Promise<StockLocationDTO>Required

Methods

associateLocation

**associateLocation**(salesChannelId, locationId): Promise&#60;void&#62;

Associates a sales channel with a stock location.

Parameters

salesChannelIdstringRequired
The ID of the sales channel.
locationIdstringRequired
The ID of the stock location.

Returns

Promise<void>

PromisePromise<void>Required
A promise that resolves when the association has been created.

atomicPhase_

Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise&#60;TResult&#62;

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.

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

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

listLocationIds

**listLocationIds**(salesChannelId): Promise&#60;string[]&#62;

Lists the stock locations associated with a sales channel.

Parameters

salesChannelIdstring | string[]Required
The ID of the sales channel.

Returns

Promise<string[]>

PromisePromise<string[]>Required
A promise that resolves with an array of location IDs.

listSalesChannelIds

**listSalesChannelIds**(locationId): Promise&#60;string[]&#62;

Lists the sales channels associated with a stock location.

Parameters

locationIdstringRequired

Returns

Promise<string[]>

PromisePromise<string[]>Required
A promise that resolves with an array of sales channel IDs.

removeLocation

**removeLocation**(locationId, salesChannelId?): Promise&#60;void&#62;

Removes an association between a sales channel and a stock location.

Parameters

locationIdstringRequired
The ID of the stock location.
salesChannelIdstring
The ID of the sales channel or undefined if all the sales channel will be affected.

Returns

Promise<void>

PromisePromise<void>Required
A promise that resolves when the association has been removed.

shouldRetryTransaction_

Protected **shouldRetryTransaction_**(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

withTransaction

**withTransaction**(transactionManager?): [SalesChannelLocationService](/references/services/classes/SalesChannelLocationService)

Parameters

transactionManagerEntityManager

Returns

SalesChannelLocationService

SalesChannelLocationServiceSalesChannelLocationServiceRequired
Was this section helpful?