Skip to main content
Skip to main content
You're viewing the documentation for v1, which isn't the latest Medusa version.Latest documentation

NoteService

constructor​

Parameters​

__namedParametersInjectedDependenciesRequired

Properties​

manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
__container__anyRequired
EventsobjectRequired
Events.CREATEDstringRequired

Default: "note.created"

Events.UPDATEDstringRequired

Default: "note.updated"

Events.DELETEDstringRequired

Default: "note.deleted"

noteRepository_Repository<Note>Required
eventBus_EventBusServiceRequired
__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors​

activeManager_​

Returns​

EntityManagerEntityManagerRequired

Methods​

withTransaction​

Parameters​

transactionManagerEntityManager

Returns​

thisthisRequired

shouldRetryTransaction_​

Parameters​

errRecord<string, unknown> | objectRequired

Returns​

booleanbooleanRequired

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​

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​

PromisePromise<TResult>Required
the result of the transactional work

retrieve​

Retrieves a specific note.

Parameters​

noteIdstringRequired
the id of the note to retrieve.
configFindConfig<Note>Required
any options needed to query for the result.

Default: {}

Returns​

PromisePromise<Note>Required
which resolves to the requested note.

list​

Fetches all notes related to the given selector

Parameters​

selectorSelector<Note>Required
the query object for find
configFindConfig<Note>Required
the configuration used to find the objects. contains relations, skip, and take.

Returns​

PromisePromise<Note[]>Required
notes related to the given search.

listAndCount​

Fetches all notes related to the given selector

Parameters​

selectorSelector<Note>Required
the query object for find
configFindConfig<Note>Required
the configuration used to find the objects. contains relations, skip, and take.

Returns​

PromisePromise<[Note[], number]>Required
notes related to the given search.

create​

Creates a note associated with a given author

Parameters​

dataCreateNoteInputRequired
the note to create
configobjectRequired
any configurations if needed, including meta data
config.metadataRecord<string, unknown>Required

Returns​

PromisePromise<Note>Required
resolves to the creation result

update​

Updates a given note with a new value

Parameters​

noteIdstringRequired
the id of the note to update
valuestringRequired
the new value

Returns​

PromisePromise<Note>Required
resolves to the updated element

delete​

Deletes a given note

Parameters​

noteIdstringRequired
id of the note to delete

Returns​

PromisePromise<void>Required
Deletes a given note
Was this section helpful?