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.

use externalId

Kiran K8099afdbcd2e
diff --git a/apps/web/app/api/customers/[id]/route.ts b/apps/web/app/api/customers/[id]/route.ts
index ec312bdc72..129a3f7672 100644
--- a/apps/web/app/api/customers/[id]/route.ts
+++ b/apps/web/app/api/customers/[id]/route.ts
@@ -42,7 +42,7 @@ export const PATCH = withWorkspace(
const { id: externalId } = params;
const {
- id: newExternalId,
+ externalId: newExternalId,
name,
email,
avatar,
diff --git a/apps/web/app/api/customers/route.ts b/apps/web/app/api/customers/route.ts
index 8b27933b0e..67de6cc722 100644
--- a/apps/web/app/api/customers/route.ts
+++ b/apps/web/app/api/customers/route.ts
@@ -32,7 +32,7 @@ export const GET = withWorkspace(
// POST /api/customers – Create a new customer
export const POST = withWorkspace(
async ({ req, workspace }) => {
- const { id, email, name, avatar } = createCustomerBodySchema.parse(
+ const { externalId, email, name, avatar } = createCustomerBodySchema.parse(
await parseRequestBody(req),
);
@@ -44,7 +44,7 @@ export const POST = withWorkspace(
name: finalCustomerName,
email,
avatar,
- externalId: id,
+ externalId,
projectId: workspace.id,
projectConnectId: workspace.stripeConnectId,
},
diff --git a/apps/web/lib/zod/schemas/customers.ts b/apps/web/lib/zod/schemas/customers.ts
index 6754274de5..1fd1087705 100644
--- a/apps/web/lib/zod/schemas/customers.ts
+++ b/apps/web/lib/zod/schemas/customers.ts
@@ -1,7 +1,7 @@
import z from "@/lib/zod";
export const createCustomerBodySchema = z.object({
- id: z
+ externalId: z
.string()
.describe("Unique identifier for the customer in the client's app."),
email: z
@@ -29,7 +29,6 @@ export const CustomerSchema = z.object({
id: z.string().describe("The unique identifier of the customer in Dub."),
externalId: z
.string()
- .nullish()
.describe("Unique identifier for the customer in the client's app."),
name: z.string().describe("Name of the customer."),
email: z.string().nullish().describe("Email of the customer."),