Skip to main content
Skip to main content

RepositoryService

Data access layer (DAL) interface to implements for any repository service. This layer helps to separate the business logic (service layer) from accessing the ORM directly and allows to switch to another ORM without changing the business logic.

Type parameters

TobjectRequired

Methods

create

Parameters
dataunknown[]Required
contextContext
Returns
PromisePromise<T[]>Required

delete

Parameters
idsstring[]Required
contextContext
Returns
PromisePromise<void>Required

find

Parameters
optionsFindOptions<T>
contextContext
Returns
PromisePromise<T[]>Required

findAndCount

Parameters
optionsFindOptions<T>
contextContext
Returns
PromisePromise<[T[], number]>Required

getActiveManager

Returns
TManagerTManagerRequired

getFreshManager

Returns
TManagerTManagerRequired

restore

Parameters
idsstring[]Required
contextContext
Returns
PromisePromise<[T[], Record<string, unknown[]>]>Required

serialize

Parameters
dataanyRequired
optionsany
Returns
PromisePromise<TOutput>Required

softDelete

Soft delete entities and cascade to related entities if configured.

Parameters
idsstring[]Required
contextContext
Returns
PromisePromise<[T[], Record<string, unknown[]>]>Required
[T[], Record<string, string[]>] the second value being the map of the entity names and ids that were soft deleted

transaction

Parameters
task(transactionManager: TManager) => Promise<any>Required
contextobject
context.enableNestedTransactionsboolean
context.isolationLevelstring
context.transactionTManager
Returns
PromisePromise<any>Required

update

Parameters
dataunknown[]Required
contextContext
Returns
PromisePromise<T[]>Required
Was this section helpful?