mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: search event log by tags (#4604)
This commit is contained in:
		
							parent
							
								
									19ec66a9d1
								
							
						
					
					
						commit
						848b35a7a6
					
				@ -342,6 +342,7 @@ class EventStore implements IEventStore {
 | 
				
			|||||||
                    .orWhereRaw('type::text ILIKE ?', `%${search.query}%`)
 | 
					                    .orWhereRaw('type::text ILIKE ?', `%${search.query}%`)
 | 
				
			||||||
                    .orWhereRaw('created_by::text ILIKE ?', `%${search.query}%`)
 | 
					                    .orWhereRaw('created_by::text ILIKE ?', `%${search.query}%`)
 | 
				
			||||||
                    .orWhereRaw('data::text ILIKE ?', `%${search.query}%`)
 | 
					                    .orWhereRaw('data::text ILIKE ?', `%${search.query}%`)
 | 
				
			||||||
 | 
					                    .orWhereRaw('tags::text ILIKE ?', `%${search.query}%`)
 | 
				
			||||||
                    .orWhereRaw('pre_data::text ILIKE ?', `%${search.query}%`),
 | 
					                    .orWhereRaw('pre_data::text ILIKE ?', `%${search.query}%`),
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -89,7 +89,7 @@ test('can search for events', async () => {
 | 
				
			|||||||
            project: randomId(),
 | 
					            project: randomId(),
 | 
				
			||||||
            data: { id: randomId() },
 | 
					            data: { id: randomId() },
 | 
				
			||||||
            preData: { id: randomId() },
 | 
					            preData: { id: randomId() },
 | 
				
			||||||
            tags: [],
 | 
					            tags: [{ type: 'simple', value: randomId() }],
 | 
				
			||||||
            createdBy: randomId(),
 | 
					            createdBy: randomId(),
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
@ -113,7 +113,6 @@ test('can search for events', async () => {
 | 
				
			|||||||
        .expect(200)
 | 
					        .expect(200)
 | 
				
			||||||
        .expect((res) => {
 | 
					        .expect((res) => {
 | 
				
			||||||
            expect(res.body.events).toHaveLength(1);
 | 
					            expect(res.body.events).toHaveLength(1);
 | 
				
			||||||
            expect(res.body.events[0].data.id).toEqual(events[0].data.id);
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    await app.request
 | 
					    await app.request
 | 
				
			||||||
        .post('/api/admin/events/search')
 | 
					        .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).toHaveLength(1);
 | 
				
			||||||
            expect(res.body.events[0].preData.id).toEqual(events[1].preData.id);
 | 
					            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);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user