Skip to content

Commit

Permalink
fixup! apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nabdelgadir committed Aug 14, 2019
1 parent b132f31 commit 8969d4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/repository/src/repositories/legacy-juggler-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ export class DefaultCrudRepository<
> implements EntityCrudRepository<T, ID, Relations> {
modelClass: juggler.PersistedModelClass;

public inclusionResolvers: Map<string, InclusionResolver<T, Entity>>;
public readonly inclusionResolvers: Map<
string,
InclusionResolver<T, Entity>
> = new Map();

/**
* Constructor of DefaultCrudRepository
Expand All @@ -124,7 +127,6 @@ export class DefaultCrudRepository<
);

this.modelClass = this.definePersistedModel(entityClass);
this.inclusionResolvers = new Map<string, InclusionResolver<T, Entity>>();
}

// Create an internal legacy Model attached to the datasource
Expand Down
6 changes: 4 additions & 2 deletions packages/repository/src/repositories/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,17 @@ export interface EntityCrudRepository<
export class CrudRepositoryImpl<T extends Entity, ID>
implements EntityCrudRepository<T, ID> {
private connector: CrudConnector;
public inclusionResolvers: Map<string, InclusionResolver<T, Entity>>;
public readonly inclusionResolvers: Map<
string,
InclusionResolver<T, Entity>
> = new Map();

constructor(
public dataSource: DataSource,
// model should have type "typeof T", but that's not supported by TSC
public entityClass: typeof Entity & {prototype: T},
) {
this.connector = dataSource.connector as CrudConnector;
this.inclusionResolvers = new Map<string, InclusionResolver<T, Entity>>();
}

private toModels(data: Promise<DataObject<Entity>[]>): Promise<T[]> {
Expand Down

0 comments on commit 8969d4c

Please sign in to comment.