NoteService
Properties
__configModule__Record<string, unknown>__container__anyRequired__moduleDeclaration__Record<string, unknown>manager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequiredEventsobjectRequiredEvents.CREATEDstringRequiredEvents.DELETEDstringRequiredEvents.UPDATEDstringRequiredAccessors
activeManager_
Protected get activeManager_(): EntityManager
Returns
EntityManager
EntityManagerEntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
atomicPhase_
Protected atomicPhase_<TResult, 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.
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
PromisePromise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
create
create(data, config?): Promise<Note>
Creates a note associated with a given author
Parameters
configobjectconfig.metadataRecord<string, unknown>RequiredReturns
Promise<Note>
resolves to the creation result
delete
delete(noteId): Promise<void>
Deletes a given note
Parameters
noteIdstringRequiredReturns
Promise<void>
PromisePromise<void>Requiredlist
list(selector, config?): Promise<Note[]>
Fetches all notes related to the given selector
Parameters
configFindConfig<Note>Returns
Promise<Note[]>
notes related to the given search.
listAndCount
listAndCount(selector, config?): Promise<[Note[], number]>
Fetches all notes related to the given selector
Parameters
configFindConfig<Note>Returns
Promise<[Note[], number]>
notes related to the given search.
retrieve
retrieve(noteId, config?): Promise<Note>
Retrieves a specific note.
Parameters
noteIdstringRequiredconfigFindConfig<Note>Returns
Promise<Note>
which resolves to the requested note.
shouldRetryTransaction_
Protected shouldRetryTransaction_(err): boolean
Parameters
errRecord<string, unknown> | { code: string }RequiredReturns
boolean
booleanbooleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(noteId, value): Promise<Note>
Updates a given note with a new value
Parameters
noteIdstringRequiredvaluestringRequiredReturns
Promise<Note>
resolves to the updated element
withTransaction
withTransaction(transactionManager?): NoteService
Parameters
transactionManagerEntityManager