ProductCollectionService
Provides layer to manipulate product collections.
constructor
Parameters
__namedParametersInjectedDependenciesRequiredProperties
manager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequired__container__anyRequiredEventsobjectRequiredEvents.CREATEDstringRequiredDefault: "product-collection.created"
Events.UPDATEDstringRequiredDefault: "product-collection.updated"
Events.DELETEDstringRequiredDefault: "product-collection.deleted"
Events.PRODUCTS_ADDEDstringRequiredDefault: "product-collection.products_added"
Events.PRODUCTS_REMOVEDstringRequiredDefault: "product-collection.products_removed"
__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredMethods
withTransaction
Parameters
transactionManagerEntityManagerReturns
thisthisRequiredshouldRetryTransaction_
Parameters
errRecord<string, unknown> | objectRequiredReturns
booleanbooleanRequiredatomicPhase_
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
retrieve
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.
create
Creates a product collection
Parameters
collectionCreateProductCollectionRequiredthe collection to create
Returns
created collection
update
Updates a product collection
Parameters
collectionIdstringRequiredid of collection to update
updateUpdateProductCollectionRequiredupdate object
Returns
update collection
delete
Deletes a product collection idempotently
Parameters
collectionIdstringRequiredid of collection to delete
Returns
PromisePromise<void>Requiredempty promise
addProducts
Parameters
collectionIdstringRequiredproductIdsstring[]RequiredReturns
removeProducts
Parameters
collectionIdstringRequiredproductIdsstring[]RequiredReturns
PromisePromise<void>Requiredlist
Lists product collections
Parameters
the query object for find
Default: {}
configobjectRequiredthe config to be used for find
config.skipnumberRequiredDefault: 0
config.takenumberRequiredDefault: 20
Returns
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
Was this section helpful?