Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
fix getReports for website, user, team
Francis Caod40807e6727b
diff --git a/src/app/(main)/reports/ReportsPage.tsx b/src/app/(main)/reports/ReportsPage.tsxindex a76a6a47a..5b031cfae 100644--- a/src/app/(main)/reports/ReportsPage.tsx+++ b/src/app/(main)/reports/ReportsPage.tsx@@ -2,8 +2,11 @@import { Metadata } from 'next';import ReportsHeader from './ReportsHeader';import ReportsDataTable from './ReportsDataTable';+import { useTeamUrl } from 'components/hooks';++export default function ReportsPage() {+ const { teamId } = useTeamUrl();-export default function ReportsPage({ teamId }: { teamId: string }) {return (<><ReportsHeader />diff --git a/src/app/(main)/reports/page.tsx b/src/app/(main)/reports/page.tsxindex 4b495aca8..ef4e56ada 100644--- a/src/app/(main)/reports/page.tsx+++ b/src/app/(main)/reports/page.tsx@@ -1,8 +1,8 @@import ReportsPage from './ReportsPage';import { Metadata } from 'next';-export default function ({ params: { teamId } }: { params: { teamId: string } }) {- return <ReportsPage teamId={teamId} />;+export default function () {+ return <ReportsPage />;}export const metadata: Metadata = {diff --git a/src/pages/api/reports/index.ts b/src/pages/api/reports/index.tsindex 186a18211..f9d4cca4d 100644--- a/src/pages/api/reports/index.ts+++ b/src/pages/api/reports/index.ts@@ -66,11 +66,29 @@ export default async (const data = await getReports({where: {- userId: !teamId && !websiteId ? userId : undefined,- websiteId,- website: {- teamId,- },+ OR: [+ ...(websiteId ? [{ websiteId }] : []),+ ...(teamId+ ? [+ {+ website: {+ deletedAt: null,+ teamId,+ },+ },+ ]+ : []),+ ...(userId+ ? [+ {+ website: {+ deletedAt: null,+ userId,+ },+ },+ ]+ : []),+ ],},include: {website: {