Skip to main content
Skip to main content

NoteService

internal.internal.NoteService

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
eventBus_EventBusServiceRequired
manager_EntityManagerRequired
noteRepository_Repository<Note>Required
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CREATEDstringRequired
Events.DELETEDstringRequired
Events.UPDATEDstringRequired

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited 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.

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

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_


create

create(data, config?): Promise<Note>

Creates a note associated with a given author

Parameters

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

Returns

Promise<Note>

PromisePromise<Note>Required
resolves to the creation result

delete

delete(noteId): Promise<void>

Deletes a given note

Parameters

noteIdstringRequired
id of the note to delete

Returns

Promise<void>

PromisePromise<void>Required

list

list(selector, config?): Promise<Note[]>

Fetches all notes related to the given selector

Parameters

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

Returns

Promise<Note[]>

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

listAndCount

listAndCount(selector, config?): Promise<[Note[], number]>

Fetches all notes related to the given selector

Parameters

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

Returns

Promise<[Note[], number]>

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

retrieve

retrieve(noteId, config?): Promise<Note>

Retrieves a specific note.

Parameters

noteIdstringRequired
the id of the note to retrieve.
any options needed to query for the result.

Returns

Promise<Note>

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

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


update

update(noteId, value): Promise<Note>

Updates a given note with a new value

Parameters

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

Returns

Promise<Note>

PromisePromise<Note>Required
resolves to the updated element

withTransaction

withTransaction(transactionManager?): NoteService

Parameters

transactionManagerEntityManager

Returns

NoteService

NoteServiceNoteServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?