📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
fix: when view is not supplied, result is 404
Blue Mouse743f8bb60aa2
diff --git a/apps/production/src/analytics/analytics.controller.ts b/apps/production/src/analytics/analytics.controller.tsindex fef296e28..1e12dcf24 100644--- a/apps/production/src/analytics/analytics.controller.ts+++ b/apps/production/src/analytics/analytics.controller.ts@@ -412,25 +412,32 @@ export class AnalyticsController {throw new ConflictException('Cannot specify both viewId and filters.')}- const view = await this.projectsViewsRepository.findProjectView(pid, viewId)+ let meta: Awaited<ReturnType<typeof this.analyticsService.getMetaResult>>- if (!view) {- throw new NotFoundException('View not found.')- }+ if (viewId) {+ const view = await this.projectsViewsRepository.findProjectView(+ pid,+ viewId,+ )- const customEvents = view.customEvents.map(event => ({- customEventName: event.customEventName,- metaKey: event.metaKey,- metaValue: event.metaValue,- metaValueType: event.metaValueType,- }))+ if (!view) {+ throw new NotFoundException('View not found.')+ }- const metaKeys = customEvents.map(event => event.metaKey)- const metaResult = await this.analyticsService.getMetaResult(- pid,- metaKeys,- customEvents,- )+ const customEvents = view.customEvents.map(event => ({+ customEventName: event.customEventName,+ metaKey: event.metaKey,+ metaValue: event.metaValue,+ metaValueType: event.metaValueType,+ }))++ const metaKeys = customEvents.map(event => event.metaKey)+ meta = await this.analyticsService.getMetaResult(+ pid,+ metaKeys,+ customEvents,+ )+ }let newTimebucket = timeBucketlet allowedTumebucketForPeriodAll@@ -543,7 +550,7 @@ export class AnalyticsController {properties,appliedFilters,timeBucket: allowedTumebucketForPeriodAll,- meta: metaResult,+ meta,}}