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
T
objectRequiredMethods
create
Parameters
data
unknown[]Requiredcontext
ContextReturns
Promise
Promise<T[]>Requireddelete
Parameters
ids
string[]Requiredcontext
ContextReturns
Promise
Promise<void>Requiredfind
Parameters
options
FindOptions<T>context
ContextReturns
Promise
Promise<T[]>RequiredfindAndCount
Parameters
options
FindOptions<T>context
ContextReturns
Promise
Promise<[T[], number]>RequiredgetActiveManager
Returns
getFreshManager
Returns
restore
Parameters
ids
string[]Requiredcontext
ContextReturns
Promise
Promise<[T[], Record<string, unknown[]>]>Requiredserialize
Parameters
data
anyRequiredoptions
anyReturns
Promise
Promise<TOutput>RequiredsoftDelete
Soft delete entities and cascade to related entities if configured.
Parameters
ids
string[]Requiredcontext
ContextReturns
Promise
Promise<[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>Requiredcontext
objectcontext.enableNestedTransactions
booleancontext.isolationLevel
stringcontext.transaction
TManagerReturns
Promise
Promise<any>Requiredupdate
Parameters
data
unknown[]Requiredcontext
ContextReturns
Promise
Promise<T[]>RequiredWas this section helpful?