Skip to main content

Class: SalesChannelLocationService

Service for managing the stock locations of sales channels

Hierarchy

  • TransactionBaseServiceCopy to Clipboard

    SalesChannelLocationServiceCopy to Clipboard

Constructors

constructor

new SalesChannelLocationService(__namedParametersCopy to Clipboard)

Parameters

NameType
__namedParametersCopy to ClipboardInjectedDependenciesCopy to Clipboard

Overrides

TransactionBaseService.constructor

Defined in

packages/medusa/src/services/sales-channel-location.ts:26

Properties

__configModule__

ProtectedCopy to Clipboard OptionalCopy to Clipboard ReadonlyCopy to Clipboard __configModule__: RecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard>

Inherited from

TransactionBaseService.__configModule__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:10


__container__

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard __container__: anyCopy to Clipboard

Inherited from

TransactionBaseService.__container__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:9


__moduleDeclaration__

ProtectedCopy to Clipboard OptionalCopy to Clipboard ReadonlyCopy to Clipboard __moduleDeclaration__: RecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard>

Inherited from

TransactionBaseService.__moduleDeclaration__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:11


eventBusService

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard eventBusService: EventBusServiceCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel-location.ts:23


manager_

ProtectedCopy to Clipboard manager_: EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.manager_

Defined in

packages/medusa/src/services/sales-channel-location.ts:19


salesChannelService_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard salesChannelService_: SalesChannelServiceCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel-location.ts:22


stockLocationService

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard stockLocationService: IStockLocationServiceCopy to Clipboard

Defined in

packages/medusa/src/services/sales-channel-location.ts:24


transactionManager_

ProtectedCopy to Clipboard transactionManager_: undefinedCopy to Clipboard | EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.transactionManager_

Defined in

packages/medusa/src/services/sales-channel-location.ts:20

Methods

associateLocation

associateLocation(salesChannelIdCopy to Clipboard, locationIdCopy to Clipboard): PromiseCopy to Clipboard<voidCopy to Clipboard>

Associates a sales channel with a stock location.

Parameters

NameTypeDescription
salesChannelIdCopy to ClipboardstringCopy to ClipboardThe ID of the sales channel.
locationIdCopy to ClipboardstringCopy to ClipboardThe ID of the stock location.

Returns

PromiseCopy to Clipboard<voidCopy to Clipboard>

A promise that resolves when the association has been created.

Defined in

packages/medusa/src/services/sales-channel-location.ts:77


atomicPhase_

ProtectedCopy to Clipboard atomicPhase_<TResultCopy to Clipboard, TErrorCopy to Clipboard>(workCopy to Clipboard, isolationOrErrorHandler?Copy to Clipboard, maybeErrorHandlerOrDontFail?Copy to Clipboard): PromiseCopy to Clipboard<TResultCopy to Clipboard>

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

Name
TResultCopy to Clipboard
TErrorCopy to Clipboard

Parameters

NameTypeDescription
workCopy to Clipboard(transactionManagerCopy to Clipboard: EntityManagerCopy to Clipboard) => PromiseCopy to Clipboard<TResultCopy to Clipboard>the transactional work to be done
isolationOrErrorHandler?Copy to ClipboardIsolationLevelCopy to Clipboard | (errorCopy to Clipboard: TErrorCopy to Clipboard) => PromiseCopy to Clipboard<voidCopy to Clipboard | TResultCopy to Clipboard>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail?Copy to Clipboard(errorCopy to Clipboard: TErrorCopy to Clipboard) => PromiseCopy to Clipboard<voidCopy to Clipboard | TResultCopy to Clipboard>Potential error handler

Returns

PromiseCopy to Clipboard<TResultCopy to Clipboard>

the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:50


listLocations

listLocations(salesChannelIdCopy to Clipboard): PromiseCopy to Clipboard<stringCopy to Clipboard[]>

Lists the stock locations associated with a sales channel.

Parameters

NameTypeDescription
salesChannelIdCopy to ClipboardstringCopy to ClipboardThe ID of the sales channel.

Returns

PromiseCopy to Clipboard<stringCopy to Clipboard[]>

A promise that resolves with an array of location IDs.

Defined in

packages/medusa/src/services/sales-channel-location.ts:104


removeLocation

removeLocation(locationIdCopy to Clipboard, salesChannelId?Copy to Clipboard): PromiseCopy to Clipboard<voidCopy to Clipboard>

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

Parameters

NameTypeDescription
locationIdCopy to ClipboardstringCopy to ClipboardThe ID of the stock location.
salesChannelId?Copy to ClipboardstringCopy to ClipboardThe ID of the sales channel or undefined if all the sales channel will be affected.

Returns

PromiseCopy to Clipboard<voidCopy to Clipboard>

A promise that resolves when the association has been removed.

Defined in

packages/medusa/src/services/sales-channel-location.ts:47


shouldRetryTransaction_

ProtectedCopy to Clipboard shouldRetryTransaction_(errCopy to Clipboard): booleanCopy to Clipboard

Parameters

NameType
errCopy to ClipboardRecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard> | { codeCopy to Clipboard: stringCopy to Clipboard }

Returns

booleanCopy to Clipboard

Inherited from

TransactionBaseService.shouldRetryTransaction_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:31


withTransaction

withTransaction(transactionManager?Copy to Clipboard): SalesChannelLocationServiceCopy to Clipboard

Parameters

NameType
transactionManager?Copy to ClipboardEntityManagerCopy to Clipboard

Returns

SalesChannelLocationServiceCopy to Clipboard

Inherited from

TransactionBaseService.withTransaction

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:14