Skip to content

Commit

Permalink
fix: Coerce createdAt in the bookmark create/update APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Dec 28, 2024
1 parent 75a3fc3 commit a1a3a7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/open-api/hoarder-openapi-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@
"type": "string"
},
"createdAt": {
"type": "string"
"type": "string",
"nullable": true
}
}
},
Expand Down Expand Up @@ -748,7 +749,8 @@
"maxLength": 250
},
"createdAt": {
"type": "string"
"type": "string",
"nullable": true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/types/bookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const zNewBookmarkRequestSchema = z
favourited: z.boolean().optional(),
note: z.string().optional(),
summary: z.string().optional(),
createdAt: z.date().optional(),
createdAt: z.coerce.date().optional(),
})
.and(
z.discriminatedUnion("type", [
Expand Down Expand Up @@ -178,7 +178,7 @@ export const zUpdateBookmarksRequestSchema = z.object({
summary: z.string().nullish(),
note: z.string().optional(),
title: z.string().max(MAX_TITLE_LENGTH).nullish(),
createdAt: z.date().optional(),
createdAt: z.coerce.date().optional(),
});
export type ZUpdateBookmarksRequest = z.infer<
typeof zUpdateBookmarksRequestSchema
Expand Down

0 comments on commit a1a3a7e

Please sign in to comment.