start refactor event list

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-05-27 21:32:20 +02:00
parent 8d79949a18
commit 0e632dc493
21 changed files with 111 additions and 102 deletions

View File

@@ -189,7 +189,7 @@ export async function getEvents(
const events = await chQuery<IClickhouseEvent>(sql);
if (options.profile) {
const ids = events.map((e) => e.profile_id);
const profiles = await getProfiles({ ids });
const profiles = await getProfiles(ids);
for (const event of events) {
event.profile = profiles.find((p) => p.id === event.profile_id);

View File

@@ -59,10 +59,7 @@ interface GetProfileListOptions {
filters?: IChartEventFilter[];
}
interface GetProfilesOptions {
ids: string[];
}
export async function getProfiles({ ids }: GetProfilesOptions) {
export async function getProfiles(ids: string[]) {
if (ids.length === 0) {
return [];
}