1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

feat: search event log by tags (#4604)

This commit is contained in:
Mateusz Kwasniewski 2023-09-04 17:37:23 +02:00 committed by GitHub
parent 19ec66a9d1
commit 848b35a7a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -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}%`),
);
}

View File

@ -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(),
},
];
@ -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')
@ -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);
});
});