chore: Hide repository creation if they are not custom + add upsert support by default (#6127)

This commit is contained in:
Adrien de Peretti
2024-01-19 15:09:38 +01:00
committed by GitHub
parent 8a8a7183b8
commit 5e655dd59b
124 changed files with 1516 additions and 2559 deletions
+14 -4
View File
@@ -27,7 +27,14 @@ interface BaseRepositoryService<T = any> {
): Promise<TOutput>
}
export interface RepositoryService<T = any> extends BaseRepositoryService<T> {
type DtoBasedMutationMethods = "create" | "update"
export interface RepositoryService<
T = any,
TDTOs extends { [K in DtoBasedMutationMethods]?: any } = {
[K in DtoBasedMutationMethods]?: any
}
> extends BaseRepositoryService<T> {
find(options?: FindOptions<T>, context?: Context): Promise<T[]>
findAndCount(
@@ -35,9 +42,9 @@ export interface RepositoryService<T = any> extends BaseRepositoryService<T> {
context?: Context
): Promise<[T[], number]>
create(data: unknown[], context?: Context): Promise<T[]>
create(data: TDTOs["create"][], context?: Context): Promise<T[]>
update(data: unknown[], context?: Context): Promise<T[]>
update(data: TDTOs["update"][], context?: Context): Promise<T[]>
delete(ids: string[], context?: Context): Promise<void>
@@ -59,7 +66,10 @@ export interface RepositoryService<T = any> extends BaseRepositoryService<T> {
context?: Context
): Promise<[T[], Record<string, unknown[]>]>
upsert?(data: unknown[], context?: Context): Promise<T[]>
upsert(
data: (TDTOs["create"] | TDTOs["update"])[],
context?: Context
): Promise<T[]>
}
export interface TreeRepositoryService<T = any>