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 build

Kiran K5be16f28c5c3
diff --git a/apps/web/lib/api/customers/get-customer-or-throw.ts b/apps/web/lib/api/customers/get-customer-or-throw.ts
index 1f8f427319..72058b253b 100644
--- a/apps/web/lib/api/customers/get-customer-or-throw.ts
+++ b/apps/web/lib/api/customers/get-customer-or-throw.ts
@@ -19,5 +19,9 @@ export const getCustomerOrThrow = async ({
});
}
+ if (!customer.avatar) {
+ customer.avatar = `https://api.dicebear.com/9.x/notionists/png?seed=${customer.id}`;
+ }
+
return customer;
};
diff --git a/apps/web/lib/zod/schemas/customers.ts b/apps/web/lib/zod/schemas/customers.ts
index 90cc44adfe..a1f3ed69b4 100644
--- a/apps/web/lib/zod/schemas/customers.ts
+++ b/apps/web/lib/zod/schemas/customers.ts
@@ -26,26 +26,20 @@ export const createCustomerBodySchema = z.object({
export const updateCustomerBodySchema = createCustomerBodySchema.partial();
// customer object schema
-export const CustomerSchema = z
- .object({
- id: z.string().describe("The unique identifier of the customer in Dub."),
- externalId: z
- .string()
- .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."),
- avatar: z.string().nullish().describe("Avatar URL of the customer."),
- country: z
- .string()
- .nullish()
- .describe("The 2-letter ISO 3166-1 country code of the customer."),
- createdAt: z.date().describe("The date the customer was created."),
- })
- .superRefine((data) => {
- if (!data.avatar) {
- data.avatar = `https://api.dicebear.com/9.x/notionists/png?seed=${data.id}`;
- }
- });
+export const CustomerSchema = z.object({
+ id: z.string().describe("The unique identifier of the customer in Dub."),
+ externalId: z
+ .string()
+ .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."),
+ avatar: z.string().nullish().describe("Avatar URL of the customer."),
+ country: z
+ .string()
+ .nullish()
+ .describe("The 2-letter ISO 3166-1 country code of the customer."),
+ createdAt: z.date().describe("The date the customer was created."),
+});
export const trackCustomerRequestSchema = z.object({
// Required