mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-01 12:29:35 +01:00
fix getReports for website, user, team
This commit is contained in:
parent
111c93be20
commit
d40807e672
@ -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 />
|
||||
|
@ -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 = {
|
||||
|
@ -66,12 +66,30 @@ export default async (
|
||||
const data = await getReports(
|
||||
{
|
||||
where: {
|
||||
userId: !teamId && !websiteId ? userId : undefined,
|
||||
websiteId,
|
||||
OR: [
|
||||
...(websiteId ? [{ websiteId }] : []),
|
||||
...(teamId
|
||||
? [
|
||||
{
|
||||
website: {
|
||||
deletedAt: null,
|
||||
teamId,
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(userId
|
||||
? [
|
||||
{
|
||||
website: {
|
||||
deletedAt: null,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
},
|
||||
include: {
|
||||
website: {
|
||||
select: {
|
||||
|
Loading…
Reference in New Issue
Block a user