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 API routes and schemas for including user information in link responses

Kiran K6c9d50cfeff3
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.ts
index 1b6d50cbcb..2785eb64d7 100644
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@ -3,7 +3,6 @@ import { createLink, getLinksForWorkspace, processLink } from "@/lib/api/links";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
import { ratelimit } from "@/lib/upstash";
-import z from "@/lib/zod";
import {
LinkSchemaExtended,
createLinkBodySchema,
@@ -14,7 +13,7 @@ import { LOCALHOST_IP, getSearchParamsWithArray } from "@dub/utils";
import { NextResponse } from "next/server";
const LinkSchemaWithUser = LinkSchemaExtended.extend({
- user: UserSchema.extend({ createdAt: z.date() }),
+ user: UserSchema.nullable(),
});
// GET /api/links – get all links for a workspace
diff --git a/apps/web/lib/zod/schemas/users.ts b/apps/web/lib/zod/schemas/users.ts
index c7afe0c09e..b0063218f2 100644
--- a/apps/web/lib/zod/schemas/users.ts
+++ b/apps/web/lib/zod/schemas/users.ts
@@ -8,5 +8,4 @@ export const UserSchema = z.object({
image: z.string().nullable(),
subscribed: z.boolean().nullable(),
source: z.string().nullable(),
- createdAt: z.string(),
});
diff --git a/apps/web/package.json b/apps/web/package.json
index d81104ef67..59cd59247c 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -8,7 +8,7 @@
"lint": "next lint",
"start": "next start",
"script": "tsx ./scripts/run.ts",
- "test": "vitest -no-file-parallelism links/",
+ "test": "vitest -no-file-parallelism",
"generate-openapi": "tsx ./scripts/generate-openapi.ts"
},
"dependencies": {