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

fix: search events by user ID, not by user name (#7846)

Changes the event search handling, so that searching by user uses the
user's ID, not the "createdBy" name in the event. This aligns better
with what the OpenAPI schema describes it.
This commit is contained in:
Thomas Heartman 2024-08-13 09:32:51 +02:00 committed by GitHub
parent 507219e1c7
commit 0934c6ccd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -177,7 +177,7 @@ export default class EventService {
if (params.createdBy) {
const parsed = parseSearchOperatorValue(
'created_by',
'created_by_user_id',
params.createdBy,
);
if (parsed) queryParams.push(parsed);

View File

@ -183,7 +183,7 @@ test('should filter events by created by', async () => {
await eventService.storeEvent({
type: FEATURE_CREATED,
createdBy: 'admin1@example.com',
createdByUserId: TEST_USER_ID,
createdByUserId: TEST_USER_ID + 1,
ip: '127.0.0.1',
});
@ -194,7 +194,7 @@ test('should filter events by created by', async () => {
ip: '127.0.0.1',
});
const { body } = await searchEvents({ createdBy: 'IS:admin2@example.com' });
const { body } = await searchEvents({ createdBy: `IS:${TEST_USER_ID}` });
expect(body).toMatchObject({
events: [