From f588fbdfc409bd6b993931bf929e967982d661f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Thu, 26 Jun 2025 09:05:03 +0200 Subject: [PATCH] WIP --- .github/workflows/build_prs_jest_report.yaml | 2 +- src/lib/features/events/event-service.ts | 24 +++++++++++++++++++- src/lib/types/stores/event-store.ts | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_prs_jest_report.yaml b/.github/workflows/build_prs_jest_report.yaml index 7a34807384..ca7c5ee8c8 100644 --- a/.github/workflows/build_prs_jest_report.yaml +++ b/.github/workflows/build_prs_jest_report.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - pull_requests: write + pull-requests: write name: build # temporary solution to trick branch protection rules services: diff --git a/src/lib/features/events/event-service.ts b/src/lib/features/events/event-service.ts index b55ddf0bd5..07244a89a0 100644 --- a/src/lib/features/events/event-service.ts +++ b/src/lib/features/events/event-service.ts @@ -16,7 +16,7 @@ import type { IPrivateProjectChecker } from '../private-project/privateProjectCh import type { ProjectAccess } from '../private-project/privateProjectStore.js'; import type { IAccessReadModel } from '../access/access-read-model-type.js'; import lodash from 'lodash'; -import type { IEventList, IBaseEvent } from '../../events/index.js'; +import type { IEventList, IBaseEvent, IEvent } from '../../events/index.js'; import type { ITag } from '../../tags/index.js'; const { isEqual } = lodash; @@ -103,6 +103,28 @@ export default class EventService { }; } + async searchUserEvents( + search: IEventSearchParams, + ): Promise<{ events: IEvent[] }> { + const queryParams = this.convertToDbParams(search); + + const events = await this.eventStore.searchEvents( + { + limit: search.limit, + offset: search.offset, + query: search.query, + types: search.types, + }, + queryParams, + { + withIp: this.isEnterprise, + }, + ); + return { + events, + }; + } + onEvent( eventName: string | symbol, listener: (...args: any[]) => void, diff --git a/src/lib/types/stores/event-store.ts b/src/lib/types/stores/event-store.ts index 581cd03316..98a3804047 100644 --- a/src/lib/types/stores/event-store.ts +++ b/src/lib/types/stores/event-store.ts @@ -14,6 +14,7 @@ export interface IEventSearchParams { to?: string; createdBy?: string; type?: string; + types?: string[]; environment?: string; offset: number; limit: number;