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.

add `event` discriminator for /events endpoint

Steven Teyed8f6e4c33a2
diff --git a/apps/web/lib/zod/schemas/clicks.ts b/apps/web/lib/zod/schemas/clicks.ts
index 1ac67a839d..8d7735d95a 100644
--- a/apps/web/lib/zod/schemas/clicks.ts
+++ b/apps/web/lib/zod/schemas/clicks.ts
@@ -31,6 +31,7 @@ export const clickEventSchemaTB = z.object({
export const clickEventEnrichedSchema = z
.object({
+ event: z.literal("click").default("click"),
timestamp: z.string(),
click_id: z.string(),
link_id: z.string(),
@@ -47,4 +48,4 @@ export const clickEventEnrichedSchema = z
ip: z.string().nullable(),
qr: z.number().nullable(),
})
- .openapi({ ref: "ClickEvents" });
+ .openapi({ ref: "ClickEvent" });
diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.ts
index d4c9f2071f..62fbe707bb 100644
--- a/apps/web/lib/zod/schemas/leads.ts
+++ b/apps/web/lib/zod/schemas/leads.ts
@@ -72,6 +72,7 @@ export const leadEventSchemaTB = clickEventSchemaTB
export const leadEventEnrichedSchema = z
.object({
+ event: z.literal("lead").default("lead"),
timestamp: z.string(),
event_id: z.string(),
event_name: z.string(),
@@ -93,4 +94,4 @@ export const leadEventEnrichedSchema = z
qr: z.number().nullable(),
ip: z.string().nullable(),
})
- .openapi({ ref: "LeadEvents" });
+ .openapi({ ref: "LeadEvent" });
diff --git a/apps/web/lib/zod/schemas/sales.ts b/apps/web/lib/zod/schemas/sales.ts
index cf608a1c72..057ca20128 100644
--- a/apps/web/lib/zod/schemas/sales.ts
+++ b/apps/web/lib/zod/schemas/sales.ts
@@ -74,6 +74,7 @@ export const saleEventSchemaTB = clickEventSchemaTB
export const saleEventEnrichedSchema = z
.object({
+ event: z.literal("sale").default("sale"),
timestamp: z.string(),
event_id: z.string(),
event_name: z.string(),
@@ -98,4 +99,4 @@ export const saleEventEnrichedSchema = z
qr: z.number().nullable(),
ip: z.string().nullable(),
})
- .openapi({ ref: "SaleEvents" });
+ .openapi({ ref: "SaleEvent" });