Skip to main content
Skip to main content

RepositoryService

internal.DAL.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

create(data, context?): Promise<T[]>

Parameters

dataunknown[]Required
contextContext

Returns

Promise<T[]>

PromisePromise<T[]>Required

delete

delete(ids, context?): Promise<void>

Parameters

idsstring[]Required
contextContext

Returns

Promise<void>

PromisePromise<void>Required

find

find(options?, context?): Promise<T[]>

Parameters

optionsFindOptions<T>
contextContext

Returns

Promise<T[]>

PromisePromise<T[]>Required

findAndCount

findAndCount(options?, context?): Promise<[T[], number]>

Parameters

optionsFindOptions<T>
contextContext

Returns

Promise<[T[], number]>

PromisePromise<[T[], number]>Required

getActiveManager

getActiveManager<TManager>(): TManager

TManagerobjectRequired

Returns

TManager

Inherited from

BaseRepositoryService.getActiveManager


getFreshManager

getFreshManager<TManager>(): TManager

TManagerobjectRequired

Returns

TManager

Inherited from

BaseRepositoryService.getFreshManager


restore

restore(ids, context?): Promise<[T[], Record<string, unknown[]>]>

Parameters

idsstring[]Required
contextContext

Returns

Promise<[T[], Record<string, unknown[]>]>

PromisePromise<[T[], Record<string, unknown[]>]>Required

serialize

serialize<TOutput>(data, options?): Promise<TOutput>

TOutputobject | object[]Required

Parameters

dataanyRequired
optionsany

Returns

Promise<TOutput>

PromisePromise<TOutput>Required

Inherited from

BaseRepositoryService.serialize


softDelete

softDelete(ids, context?): Promise<[T[], Record<string, unknown[]>]>

Soft delete entities and cascade to related entities if configured.

Parameters

idsstring[]Required
contextContext

Returns

Promise<[T[], Record<string, unknown[]>]>

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

transaction<TManager>(task, context?): Promise<any>

TManagerobjectRequired

Parameters

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

Returns

Promise<any>

PromisePromise<any>Required

Inherited from

BaseRepositoryService.transaction


update

update(data, context?): Promise<T[]>

Parameters

dataunknown[]Required
contextContext

Returns

Promise<T[]>

PromisePromise<T[]>Required
Was this section helpful?