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 get-customer-events.ts

Kiran Ka3b67fb411f5
diff --git a/apps/web/lib/analytics/get-customer-events.ts b/apps/web/lib/analytics/get-customer-events.ts
index d51641c5a0..1365d9604a 100644
--- a/apps/web/lib/analytics/get-customer-events.ts
+++ b/apps/web/lib/analytics/get-customer-events.ts
@@ -1,16 +1,13 @@
import { tb } from "@/lib/tinybird";
import { prisma } from "@dub/prisma";
import { Link } from "@dub/prisma/client";
-import { DICEBEAR_AVATAR_URL } from "@dub/utils";
import { transformLink } from "../api/links";
import { decodeLinkIfCaseSensitive } from "../api/links/case-sensitivity";
-import { generateRandomName } from "../names";
import z from "../zod";
import {
clickEventResponseSchema,
clickEventSchema,
} from "../zod/schemas/clicks";
-import { CustomerSchema } from "../zod/schemas/customers";
import { leadEventResponseSchema } from "../zod/schemas/leads";
import { saleEventResponseSchema } from "../zod/schemas/sales";
import { EventsFilters } from "./types";
@@ -119,33 +116,3 @@ const getLinksMap = async (linkIds: string[]) => {
{} as Record<string, Link>,
);
};
-
-const getCustomersMap = async (customerIds: string[]) => {
- if (customerIds.length === 0) {
- return {};
- }
-
- const customers = await prisma.customer.findMany({
- where: {
- id: {
- in: customerIds,
- },
- },
- });
-
- return customers.reduce(
- (acc, customer) => {
- acc[customer.id] = CustomerSchema.parse({
- id: customer.id,
- externalId: customer.externalId || "",
- name: customer.name || customer.email || generateRandomName(),
- email: customer.email || "",
- avatar: customer.avatar || `${DICEBEAR_AVATAR_URL}${customer.id}`,
- country: customer.country || "",
- createdAt: customer.createdAt,
- });
- return acc;
- },
- {} as Record<string, z.infer<typeof CustomerSchema>>,
- );
-};