Skip to content

Commit

Permalink
fix: sonar findings
Browse files Browse the repository at this point in the history
Signed-off-by: Timon Masberg <[email protected]>
  • Loading branch information
timonmasberg committed Sep 20, 2024
1 parent 1f3ff22 commit b347823
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ ENV NODE_ENV=production
# Install dependencies separately for caching
COPY ./dist/apps/api/package.json ./dist/apps/api/package-lock.json ./

RUN npm i --omit=dev # ci is failing here due to nx bug https:/nrwl/nx/issues/15366 (closed, but still an issue)
# ci is failing here due to nx bug https:/nrwl/nx/issues/15366 (closed, but still an issue)
RUN npm i --omit=dev \

COPY ./dist/apps/api ./

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export abstract class AbstractEntitySearchService<
fields: searchFields as string[],
});
// first index all entities with the necessary data to search
entityProvider
.provideInitial()
.then((entities) => this.searchEngine.addAll(entities));
this.indexInitialEntitiesAsync();
}

searchByTerm(query: string): Promise<TEntity[]> {
Expand All @@ -53,4 +51,10 @@ export abstract class AbstractEntitySearchService<
// populate the entities to get the whole entity
return this.entityProvider.provideByIds(res.map((r) => r.id));
}

private indexInitialEntitiesAsync(): void {
this.entityProvider
.provideInitial()
.then((entities) => this.searchEngine.addAll(entities));
}
}

0 comments on commit b347823

Please sign in to comment.