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 { Metadata } from 'next';
|
||||||
import ReportsHeader from './ReportsHeader';
|
import ReportsHeader from './ReportsHeader';
|
||||||
import ReportsDataTable from './ReportsDataTable';
|
import ReportsDataTable from './ReportsDataTable';
|
||||||
|
import { useTeamUrl } from 'components/hooks';
|
||||||
|
|
||||||
|
export default function ReportsPage() {
|
||||||
|
const { teamId } = useTeamUrl();
|
||||||
|
|
||||||
export default function ReportsPage({ teamId }: { teamId: string }) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ReportsHeader />
|
<ReportsHeader />
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import ReportsPage from './ReportsPage';
|
import ReportsPage from './ReportsPage';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
export default function ({ params: { teamId } }: { params: { teamId: string } }) {
|
export default function () {
|
||||||
return <ReportsPage teamId={teamId} />;
|
return <ReportsPage />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
|
@ -66,11 +66,29 @@ export default async (
|
|||||||
const data = await getReports(
|
const data = await getReports(
|
||||||
{
|
{
|
||||||
where: {
|
where: {
|
||||||
userId: !teamId && !websiteId ? userId : undefined,
|
OR: [
|
||||||
websiteId,
|
...(websiteId ? [{ websiteId }] : []),
|
||||||
website: {
|
...(teamId
|
||||||
teamId,
|
? [
|
||||||
},
|
{
|
||||||
|
website: {
|
||||||
|
deletedAt: null,
|
||||||
|
teamId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
...(userId
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
website: {
|
||||||
|
deletedAt: null,
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
website: {
|
website: {
|
||||||
|
Loading…
Reference in New Issue
Block a user