diff --git a/src/app/dashboard/ads/page.tsx b/src/app/dashboard/ads/page.tsx index 34b329a..7782eba 100644 --- a/src/app/dashboard/ads/page.tsx +++ b/src/app/dashboard/ads/page.tsx @@ -15,7 +15,7 @@ export default async function AdsPage({ searchParams }: { searchParams: Promise< const mediaType = resolvedSearchParams.mediaType; const where: Prisma.AdWhereInput = {}; if (q) where.OR = [{ primaryText: { contains: q, mode: "insensitive" } }, { headline: { contains: q, mode: "insensitive" } }, { brandPage: { name: { contains: q, mode: "insensitive" } } }]; - if (niche) where.niche = niche; + if (niche) where.niche = { contains: niche, mode: "insensitive" }; if (mediaType) where.mediaType = mediaType as any; const ads = await prisma.ad.findMany({ where, include: { brandPage: true, creatives: { take: 1 }, savedBy: { where: { userId: user.id } } }, orderBy: { rankPercentile: "asc" }, take: 48 }); const isAdmin = user.role === "ADMIN"; diff --git a/src/app/dashboard/stores/page.tsx b/src/app/dashboard/stores/page.tsx index ab1432f..6ad3ab2 100644 --- a/src/app/dashboard/stores/page.tsx +++ b/src/app/dashboard/stores/page.tsx @@ -10,8 +10,8 @@ export default async function StoresPage({ searchParams }: { searchParams: Promi const q = resolvedSearchParams.q?.trim(); const niche = resolvedSearchParams.niche; const where: Prisma.StoreWhereInput = {}; - if (q) where.OR = [{ name: { contains: q, mode: "insensitive" } }, { domain: { contains: q, mode: "insensitive" } }]; - if (niche) where.niche = niche; + if (q) where.OR = [{ name: { contains: q, mode: "insensitive" } }, { domain: { contains: q, mode: "insensitive" } }, { niche: { contains: q, mode: "insensitive" } }]; + if (niche) where.niche = { contains: niche, mode: "insensitive" }; const stores = await prisma.store.findMany({ where, include: { products: { where: { isBestSeller: true }, take: 2 }, brandPages: { include: { _count: { select: { ads: true } } }, take: 1 } }, orderBy: { estRevenue30dMax: "desc" }, take: 50 }); return (