ProductCollectionService
Provides layer to manipulate product collections.
constructor
Parameters
__namedParametersInjectedDependenciesRequiredProperties
__container__anyRequiredmanager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequiredEventsobjectRequiredEvents.CREATEDstringRequiredDefault: "product-collection.created"
Events.DELETEDstringRequiredDefault: "product-collection.deleted"
Events.PRODUCTS_ADDEDstringRequiredDefault: "product-collection.products_added"
Events.PRODUCTS_REMOVEDstringRequiredDefault: "product-collection.products_removed"
Events.UPDATEDstringRequiredDefault: "product-collection.updated"
__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredMethods
addProducts
Parameters
collectionIdstringRequiredproductIdsstring[]RequiredReturns
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 product collection
Parameters
collectionCreateProductCollectionRequiredthe collection to create
Returns
created collection
delete
Deletes a product collection idempotently
Parameters
collectionIdstringRequiredid of collection to delete
Returns
PromisePromise<void>Requiredempty promise
list
Lists product collections
Parameters
selectorobjectRequiredthe query object for find
Default: {}
configobjectRequiredthe config to be used for find
config.skipnumberRequiredDefault: 0
config.takenumberRequiredDefault: 20
selector.discount_condition_idstringselector.qstringReturns
the result of the find operation
listAndCount
Lists product collections and add count.
Parameters
selectorListAndCountSelectorRequiredthe query object for find
Default: {}
the config to be used for find
Returns
the result of the find operation
removeProducts
Parameters
collectionIdstringRequiredproductIdsstring[]RequiredReturns
PromisePromise<void>Requiredretrieve
Retrieves a product collection by id.
Parameters
collectionIdstringRequiredthe id of the collection to retrieve.
the config of the collection to retrieve.
Default: {}
Returns
the collection.
retrieveByHandle
Retrieves a product collection by id.
Parameters
collectionHandlestringRequiredthe handle of the collection to retrieve.
query config for request
Default: {}
Returns
the collection.
shouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleanRequiredupdate
Updates a product collection
Parameters
collectionIdstringRequiredid of collection to update
updateUpdateProductCollectionRequiredupdate object
Returns
update collection
withTransaction
Parameters
transactionManagerEntityManagerReturns
ProductCollectionServiceobjectRequiredProvides layer to manipulate product collections.
Was this section helpful?