Skip to content

Commit

Permalink
feat: search event log by tags (#4604)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Sep 4, 2023
1 parent 19ec66a commit 848b35a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lib/db/event-store.ts
Expand Up @@ -342,6 +342,7 @@ class EventStore implements IEventStore {
.orWhereRaw('type::text ILIKE ?', `%${search.query}%`)
.orWhereRaw('created_by::text ILIKE ?', `%${search.query}%`)
.orWhereRaw('data::text ILIKE ?', `%${search.query}%`)
.orWhereRaw('tags::text ILIKE ?', `%${search.query}%`)
.orWhereRaw('pre_data::text ILIKE ?', `%${search.query}%`),
);
}
Expand Down
11 changes: 9 additions & 2 deletions src/test/e2e/api/admin/event.e2e.test.ts
Expand Up @@ -89,7 +89,7 @@ test('can search for events', async () => {
project: randomId(),
data: { id: randomId() },
preData: { id: randomId() },
tags: [],
tags: [{ type: 'simple', value: randomId() }],
createdBy: randomId(),
},
];
Expand All @@ -113,7 +113,6 @@ test('can search for events', async () => {
.expect(200)
.expect((res) => {
expect(res.body.events).toHaveLength(1);
expect(res.body.events[0].data.id).toEqual(events[0].data.id);
});
await app.request
.post('/api/admin/events/search')
Expand All @@ -131,4 +130,12 @@ test('can search for events', async () => {
expect(res.body.events).toHaveLength(1);
expect(res.body.events[0].preData.id).toEqual(events[1].preData.id);
});
await app.request
.post('/api/admin/events/search')
.send({ query: events[1].tags![0].value })
.expect(200)
.expect((res) => {
expect(res.body.events).toHaveLength(1);
expect(res.body.events[0].data.id).toEqual(events[1].data.id);
});
});

0 comments on commit 848b35a

Please sign in to comment.