improve(dashboard): better event selector and other improvements

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-06-05 11:28:06 +02:00
parent cd5dce02b8
commit f59bcfba3c
17 changed files with 470 additions and 145 deletions

View File

@@ -238,6 +238,16 @@ export function transformMinimalEvent(
};
}
export function getEventMetas(projectId: string) {
return db.eventMeta.findMany({
where: {
projectId,
},
});
}
export const getEventMetasCached = cacheable(getEventMetas, 60 * 5);
export async function getEvents(
sql: string,
options: GetEventsOptions = {},
@@ -261,17 +271,7 @@ export async function getEvents(
}
if (options.meta && projectId) {
const metas = await getCache(
`event-metas-${projectId}`,
60 * 5,
async () => {
return db.eventMeta.findMany({
where: {
projectId,
},
});
},
);
const metas = await getEventMetasCached(projectId);
const map = new Map<string, EventMeta>();
for (const meta of metas) {
map.set(meta.name, meta);