Skip to content

Commit

Permalink
fix: finding news by tags (#4231)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabiayako authored Apr 8, 2024
1 parent 6e9f031 commit 46b6431
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion apps/gp2-server/src/handlers/news/algolia-index-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ export const indexNewsHandler =
const news = await newsController.fetchById(id);
log.debug(`Fetched news ${news.id}`);

const data = {
...news,
_tags: news.tags,
};

await algoliaClient.save({
data: news,
data,
type: 'news',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('News index handler', () => {
await indexHandler(publishedEvent('42'));

expect(algoliaSearchClientMock.save).toHaveBeenCalledWith({
data: newsResponse,
data: { ...newsResponse, _tags: newsResponse.tags },
type: 'news',
});
});
Expand Down

0 comments on commit 46b6431

Please sign in to comment.