Skip to content

Commit

Permalink
feat(base-service): allow manager option to be passed directly
Browse files Browse the repository at this point in the history
  • Loading branch information
goldcaddy77 committed Sep 19, 2021
1 parent 0e81c61 commit 070550b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/core/BaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,11 @@ export class BaseService<E extends Node> {
return manager.save(entity as any, { reload: true });
}

async createMany(data: DeepPartial<E>[], userId: string, options?: BaseOptions): Promise<E[]> {
async createMany(
data: DeepPartial<E>[],
userId: string,
options?: BaseOptionsExtended
): Promise<E[]> {
const manager = this.extractManager(options);
const createdByIdObject: WarthogSpecialModel = this.hasColumn('createdById')
? { createdById: userId }
Expand Down Expand Up @@ -485,7 +489,7 @@ export class BaseService<E extends Node> {
data: DeepPartial<E>,
where: W,
userId: string,
options?: BaseOptions
options?: BaseOptionsExtended
): Promise<E> {
const manager = this.extractManager(options);
const found = await this.findOne(where);
Expand All @@ -505,7 +509,11 @@ export class BaseService<E extends Node> {
return manager.findOneOrFail(this.entityClass, result.id);
}

async delete(where: any, userId: string, options?: BaseOptions): Promise<StandardDeleteResponse> {
async delete(
where: any,
userId: string,
options?: BaseOptionsExtended
): Promise<StandardDeleteResponse> {
const manager = this.extractManager(options);

// V3: TODO: we shouldn't look for the column name, we should see if they've decorated the
Expand Down

0 comments on commit 070550b

Please sign in to comment.