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
T
objectRequiredMethods
create
create(data
, context?
): Promise
<T
[]>
Parameters
data
unknown[]Requiredcontext
ContextReturns
Promise
<T
[]>
Promise
Promise<T[]>Required
Promise
Promise<T[]>Requireddelete
delete(ids
, context?
): Promise
<void
>
Parameters
ids
string[]Requiredcontext
ContextReturns
Promise
<void
>
Promise
Promise<void>Requiredfind
find(options?
, context?
): Promise
<T
[]>
Parameters
options
FindOptions<T>context
ContextReturns
Promise
<T
[]>
Promise
Promise<T[]>Required
Promise
Promise<T[]>RequiredfindAndCount
findAndCount(options?
, context?
): Promise
<[T
[], number
]>
Parameters
options
FindOptions<T>context
ContextReturns
Promise
<[T
[], number
]>
Promise
Promise<[T[], number]>Required
Promise
Promise<[T[], number]>RequiredgetActiveManager
getActiveManager<TManager
>(): TManager
TManager
objectRequiredReturns
TManager
Inherited from
BaseRepositoryService.getActiveManager
getFreshManager
getFreshManager<TManager
>(): TManager
TManager
objectRequiredReturns
TManager
Inherited from
BaseRepositoryService.getFreshManager
restore
restore(ids
, context?
): Promise
<[T
[], Record<string
, unknown
[]>]>
Parameters
ids
string[]Requiredcontext
ContextReturns
Promise
<[T
[], Record<string
, unknown
[]>]>
Promise
Promise<[T[], Record<string, unknown[]>]>Required
Promise
Promise<[T[], Record<string, unknown[]>]>Requiredserialize
serialize<TOutput
>(data
, options?
): Promise
<TOutput
>
TOutput
object | object[]RequiredParameters
data
anyRequiredoptions
anyReturns
Promise
<TOutput
>
Promise
Promise<TOutput>RequiredInherited from
BaseRepositoryService.serialize
softDelete
softDelete(ids
, context?
): Promise
<[T
[], Record<string
, unknown
[]>]>
Soft delete entities and cascade to related entities if configured.
Parameters
ids
string[]Requiredcontext
ContextReturns
Promise
<[T
[], Record<string
, unknown
[]>]>
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
Promise
Promise<[T[], Record<string, unknown[]>]>Requiredtransaction
transaction<TManager
>(task
, context?
): Promise
<any
>
TManager
objectRequiredParameters
task
(transactionManager: TManager) => Promise<any>Requiredcontext
objectcontext.enableNestedTransactions
booleancontext.isolationLevel
stringcontext.transaction
TManagerReturns
Promise
<any
>
Promise
Promise<any>Required
Promise
Promise<any>RequiredInherited from
BaseRepositoryService.transaction
update
update(data
, context?
): Promise
<T
[]>
Parameters
data
unknown[]Requiredcontext
ContextReturns
Promise
<T
[]>
Promise
Promise<T[]>Required
Promise
Promise<T[]>Required