diff --git a/pages/api/reports/index.ts b/pages/api/reports/index.ts index db83e6ed..762f297c 100644 --- a/pages/api/reports/index.ts +++ b/pages/api/reports/index.ts @@ -37,6 +37,7 @@ export default async ( page, filter, pageSize: +pageSize || null, + includeTeams: true, }); return ok(res, data); diff --git a/queries/admin/report.ts b/queries/admin/report.ts index 22f3c62b..a053ba92 100644 --- a/queries/admin/report.ts +++ b/queries/admin/report.ts @@ -1,7 +1,7 @@ import { Prisma, Report } from '@prisma/client'; import { REPORT_FILTER_TYPES } from 'lib/constants'; import prisma from 'lib/prisma'; -import { FilterResult, ReportSearchFilter, ReportSearchFilterType, SearchFilter } from 'lib/types'; +import { FilterResult, ReportSearchFilter } from 'lib/types'; export async function createReport(data: Prisma.ReportUncheckedCreateInput): Promise { return prisma.client.report.create({ data }); @@ -155,7 +155,7 @@ export async function getReports( export async function getReportsByUserId( userId: string, - filter: SearchFilter, + filter: ReportSearchFilter, ): Promise> { return getReports( { userId, ...filter }, @@ -174,7 +174,7 @@ export async function getReportsByUserId( export async function getReportsByWebsiteId( websiteId: string, - filter: SearchFilter, + filter: ReportSearchFilter, ): Promise> { return getReports({ websiteId, ...filter }); } diff --git a/queries/admin/team.ts b/queries/admin/team.ts index 79735fc7..284b218e 100644 --- a/queries/admin/team.ts +++ b/queries/admin/team.ts @@ -1,8 +1,8 @@ import { Prisma, Team } from '@prisma/client'; -import prisma from 'lib/prisma'; import { ROLES, TEAM_FILTER_TYPES } from 'lib/constants'; import { uuid } from 'lib/crypto'; -import { FilterResult, TeamSearchFilter, TeamSearchFilterType, SearchFilter } from 'lib/types'; +import prisma from 'lib/prisma'; +import { FilterResult, TeamSearchFilter } from 'lib/types'; export interface GetTeamOptions { includeTeamUser?: boolean; @@ -142,7 +142,7 @@ export async function getTeams( export async function getTeamsByUserId( userId: string, - filter?: SearchFilter, + filter?: TeamSearchFilter, ): Promise> { return getTeams( { userId, ...filter },