Skip to content

Commit

Permalink
repo; possibility to omit properties of create
Browse files Browse the repository at this point in the history
  • Loading branch information
lostfields committed Mar 24, 2021
1 parent 3620f6b commit b316efe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/repository/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export abstract class Repository<TEntity extends Record<string, any>, TEntityId>
abstract query<T extends TEntity>(enumerable?: IEnumerable<T>, meta?: Partial<{ etag: string, continuationToken: string }>): AsyncIterableIterator<T>

abstract create(entity: TEntity, meta?: Partial<{ etag: string }>): Promise<TEntity | null>
abstract create<K extends keyof TEntity = null>(entity: Omit<TEntity, K>, meta: Partial<{ etag: string }>, ...excludedFields: Array<K>): Promise<TEntity | null>
abstract create<T extends TEntity>(entity: T, meta?: Partial<{ etag: string }>): Promise<T | null>

abstract read(id?: TEntityId): Promise<TEntity | null>

abstract update(entity: Partial<TEntity>, meta?: Partial<{ etag: string }>, ...fields: Array<keyof TEntity>): Promise<TEntity | boolean>
abstract update<T extends TEntity>(entity: Partial<T>, meta?: Partial<{ etag: string }>, ...fields: Array<keyof T>): Promise<T | boolean>
abstract update(entity: Partial<TEntity>, meta?: Partial<{ etag: string }>, ...updateFields: Array<keyof TEntity>): Promise<TEntity | boolean>
abstract update<T extends TEntity>(entity: Partial<T>, meta?: Partial<{ etag: string }>, ...updateFields: Array<keyof T>): Promise<T | boolean>

abstract delete(id: TEntity | TEntityId, meta?: Partial<{ etag: string }>): Promise<boolean>

Expand Down

0 comments on commit b316efe

Please sign in to comment.