NoteService
Constructors
constructor
**new NoteService**(«destructured»)
Parameters
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "note.created"
Events.DELETED
stringRequiredDefault: "note.deleted"
Events.UPDATED
stringRequiredDefault: "note.updated"
Accessors
activeManager_
Protected get**activeManager_**(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredMethods
atomicPhase_
Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>
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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
Promise
Promise<TResult>Requiredcreate
**create**(data, config?): Promise<[Note](/references/services/classes/Note)>
Creates a note associated with a given author
Parameters
config
objectRequiredconfig.metadata
Record<string, unknown>RequiredReturns
Promise<Note>
delete
**delete**(noteId): Promise<void>
Deletes a given note
Parameters
noteId
stringRequiredReturns
Promise<void>
Promise
Promise<void>Requiredlist
**list**(selector, config?): Promise<[Note](/references/services/classes/Note)[]>
Fetches all notes related to the given selector
Parameters
Returns
Promise<Note[]>
listAndCount
**listAndCount**(selector, config?): Promise<[[Note](/references/services/classes/Note)[], number]>
Fetches all notes related to the given selector
Parameters
Returns
Promise<[Note[], number]>
retrieve
**retrieve**(noteId, config?): Promise<[Note](/references/services/classes/Note)>
Retrieves a specific note.
Parameters
noteId
stringRequiredDefault: {}
Returns
Promise<Note>
shouldRetryTransaction_
Protected **shouldRetryTransaction_**(err): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanupdate
**update**(noteId, value): Promise<[Note](/references/services/classes/Note)>
Updates a given note with a new value
Parameters
noteId
stringRequiredvalue
stringRequiredReturns
Promise<Note>
withTransaction
**withTransaction**(transactionManager?): [NoteService](/references/services/classes/NoteService)
Parameters
transactionManager
EntityManager