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.

update admin

Steven Tey71b1f0f8215e
diff --git a/apps/web/app/api/admin/links/count/route.ts b/apps/web/app/api/admin/links/count/route.ts
index e98e1a0636..907156b5f8 100644
--- a/apps/web/app/api/admin/links/count/route.ts
+++ b/apps/web/app/api/admin/links/count/route.ts
@@ -1,6 +1,6 @@
import { withAdmin } from "@/lib/auth";
import { prisma } from "@dub/prisma";
-import { DUB_DOMAINS_ARRAY } from "@dub/utils";
+import { DUB_DOMAINS_ARRAY, LEGAL_USER_ID } from "@dub/utils";
import { NextResponse } from "next/server";
// GET /api/admin/links/count
@@ -17,6 +17,9 @@ export const GET = withAdmin(async ({ searchParams }) => {
const tagIds = tagId ? tagId.split(",") : [];
const linksWhere = {
+ userId: {
+ not: LEGAL_USER_ID,
+ },
// when filtering by domain, only filter by domain if the filter group is not "Domains"
...(domain && groupBy !== "domain"
? {
diff --git a/apps/web/app/api/admin/links/route.ts b/apps/web/app/api/admin/links/route.ts
index cb7a7c16ab..13a8229f27 100644
--- a/apps/web/app/api/admin/links/route.ts
+++ b/apps/web/app/api/admin/links/route.ts
@@ -1,6 +1,6 @@
import { withAdmin } from "@/lib/auth";
import { prisma } from "@dub/prisma";
-import { DUB_DOMAINS_ARRAY } from "@dub/utils";
+import { DUB_DOMAINS_ARRAY, LEGAL_USER_ID } from "@dub/utils";
import { NextResponse } from "next/server";
// GET /api/admin/links
@@ -19,6 +19,9 @@ export const GET = withAdmin(async ({ searchParams }) => {
const response = await prisma.link.findMany({
where: {
+ userId: {
+ not: LEGAL_USER_ID,
+ },
...(domain
? { domain }
: {
diff --git a/apps/web/scripts/ban-links.ts b/apps/web/scripts/ban-links.ts
new file mode 100644
index 0000000000..fa2a273764
--- /dev/null
+++ b/apps/web/scripts/ban-links.ts
@@ -0,0 +1,27 @@
+import { prisma } from "@dub/prisma";
+import { LEGAL_USER_ID, LEGAL_WORKSPACE_ID } from "@dub/utils";
+import "dotenv-flow/config";
+
+async function main() {
+ const links = await prisma.link.updateMany({
+ where: {
+ domain: "dub.sh",
+ url: {
+ contains: "secure329.inmotionhosting.com",
+ },
+ },
+ // select: {
+ // shortLink: true,
+ // url: true,
+ // projectId: true,
+ // userId: true,
+ // },
+ data: {
+ projectId: LEGAL_WORKSPACE_ID,
+ userId: LEGAL_USER_ID,
+ },
+ });
+ console.table(links);
+}
+
+main();