Fix search results.

This commit is contained in:
Brian Cao 2023-08-11 11:37:01 -07:00
parent 937ff82d9f
commit cbed961d01
3 changed files with 25 additions and 23 deletions

View file

@ -1,5 +1,5 @@
import { useAuth, useCors } from 'lib/middleware'; import { useAuth, useCors } from 'lib/middleware';
import { NextApiRequestQueryBody, WebsiteSearchFilterType } from 'lib/types'; import { NextApiRequestQueryBody, SearchFilter, WebsiteSearchFilterType } from 'lib/types';
import { NextApiResponse } from 'next'; import { NextApiResponse } from 'next';
import { methodNotAllowed } from 'next-basics'; import { methodNotAllowed } from 'next-basics';

View file

@ -104,7 +104,7 @@ export async function getTeams(
...((filterType === TEAM_FILTER_TYPES.all || ...((filterType === TEAM_FILTER_TYPES.all ||
filterType === TEAM_FILTER_TYPES['user:username']) && { filterType === TEAM_FILTER_TYPES['user:username']) && {
teamUser: { teamUser: {
every: { some: {
role: ROLES.teamOwner, role: ROLES.teamOwner,
user: { user: {
username: { username: {

View file

@ -57,7 +57,8 @@ export async function getWebsites(
}, },
}, },
}), }),
AND: { AND: [
{
OR: [ OR: [
{ {
...(userId && { ...(userId && {
@ -81,7 +82,8 @@ export async function getWebsites(
}, },
], ],
}, },
...(filter && filterQuery), { ...(filter && filterQuery) },
],
}; };
const [pageFilters, getParameters] = prisma.getPageFilters({ const [pageFilters, getParameters] = prisma.getPageFilters({