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 the date type

Kiran K7aa1e9fd190f
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index b918d451e9..a0c26854c0 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -388,14 +388,14 @@ export const LinkSchema = z
.number()
.default(0)
.describe("The number of clicks on the short link."),
- lastClicked: z.coerce
+ lastClicked: z
.string()
.nullable()
.describe("The date and time when the short link was last clicked."),
- createdAt: z.coerce
+ createdAt: z
.string()
.describe("The date and time when the short link was created."),
- updatedAt: z.coerce
+ updatedAt: z
.string()
.describe("The date and time when the short link was last updated."),
projectId: z
@@ -428,7 +428,10 @@ export const getLinkInfoQuerySchema = domainKeySchema.partial().merge(
// This is because Prisma returns a `Date` object
// TODO: Find a better way to handle this
export const LinkSchemaExtended = LinkSchema.extend({
+ createdAt: z.date(),
+ updatedAt: z.date(),
expiresAt: z.date().nullable(),
+ lastClicked: z.date().nullable(),
});
export const getLinksQuerySchemaExtended = getLinksQuerySchema.merge(