start refactor event list
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user