Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix admin search

Steven Tey4cacbb2fab11
diff --git a/apps/web/app/api/admin/links/count/route.ts b/apps/web/app/api/admin/links/count/route.ts
index 89edc7c0de..469a9b53e3 100644
--- a/apps/web/app/api/admin/links/count/route.ts
+++ b/apps/web/app/api/admin/links/count/route.ts
@@ -3,7 +3,7 @@ import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { DUB_DOMAINS, LEGAL_USER_ID } from "@dub/utils";
-// GET /api/links – get all user links
+// GET /api/admin/links/count
export const GET = withAdmin(async ({ searchParams }) => {
let { groupBy, search, domain, tagId } = searchParams as {
groupBy?: "domain" | "tagId";
diff --git a/apps/web/app/api/admin/links/route.ts b/apps/web/app/api/admin/links/route.ts
index 9d9612433d..998ec9a4c5 100644
--- a/apps/web/app/api/admin/links/route.ts
+++ b/apps/web/app/api/admin/links/route.ts
@@ -3,23 +3,20 @@ import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { DUB_DOMAINS, LEGAL_USER_ID } from "@dub/utils";
-// GET /api/links – get all user links
+// GET /api/admin/links
export const GET = withAdmin(async ({ searchParams }) => {
const {
domain,
- tagId,
search,
sort = "createdAt",
page,
- userId,
} = searchParams as {
domain?: string;
- tagId?: string;
search?: string;
sort?: "createdAt" | "clicks" | "lastClicked";
page?: string;
- userId?: string;
};
+
const response = await prisma.link.findMany({
where: {
...(domain
@@ -39,16 +36,9 @@ export const GET = withAdmin(async ({ searchParams }) => {
},
],
}),
- OR: [
- {
- userId: {
- not: LEGAL_USER_ID,
- },
- },
- {
- userId: null,
- },
- ],
+ userId: {
+ not: LEGAL_USER_ID,
+ },
},
include: {
user: true,