DraftOrderService
Handles draft orders
Implements
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "draft_order.created"
Events.UPDATED
stringRequiredDefault: "draft_order.updated"
__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (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
Promise<TResult>Requiredthe result of the transactional work
retrieve
Retrieves a draft order with the given id.
Parameters
draftOrderId
stringRequiredid of the draft order to retrieve
query object for findOne
Default: {}
Returns
the draft order
retrieveByCartId
Retrieves a draft order based on its associated cart id
Parameters
cartId
stringRequiredcart id that the draft orders's cart has
query object for findOne
Default: {}
Returns
the draft order
delete
Deletes draft order idempotently.
Parameters
draftOrderId
stringRequiredid of draft order to delete
Returns
empty promise
listAndCount
Lists draft orders alongside the count
Parameters
selector
anyRequiredquery selector to filter draft orders
query config
Returns
draft orders
list
Lists draft orders
Parameters
selector
anyRequiredquery object for find
configurable attributes for find
Returns
list of draft orders
create
Creates a draft order.
Parameters
data
DraftOrderCreatePropsRequireddata to create draft order from
Returns
the created draft order
registerCartCompletion
Registers a draft order as completed, when an order has been completed.
Parameters
draftOrderId
stringRequiredid of draft order to complete
orderId
stringRequiredid of order completed from draft order cart
Returns
Promise
Promise<UpdateResult>Requiredthe created order
update
Updates a draft order with the given data
Parameters
id
stringRequiredid of the draft order
data
objectRequiredvalues to update the order with
data.no_notification_order
booleanRequiredReturns
the updated draft order
Was this section helpful?