diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-04-14 00:51:56 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-14 00:51:56 +0300 |
| commit | 4f17ea61cbb11a72712a1ea8c98904a1cc513e41 (patch) | |
| tree | 4f1dd775e25feb3495ddb208c5fe4aa03c66fe3a /packages | |
| parent | cf0df0e6d84a76649d8cbf8adcbf83efb6e883ab (diff) | |
| download | karakeep-4f17ea61cbb11a72712a1ea8c98904a1cc513e41.tar.zst | |
feature(web): Allow changing the bookmark grid layout (#98)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/trpc/routers/bookmarks.ts | 2 | ||||
| -rw-r--r-- | packages/trpc/types/bookmarks.ts | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts index 66766205..65037f6b 100644 --- a/packages/trpc/routers/bookmarks.ts +++ b/packages/trpc/routers/bookmarks.ts @@ -103,6 +103,7 @@ function toZodSchema(bookmark: BookmarkQueryReturnType): ZBookmark { type: "asset", assetType: asset.assetType, assetId: asset.assetId, + fileName: asset.fileName, }; } else { content = { type: "unknown" }; @@ -482,6 +483,7 @@ export const bookmarksAppRouter = router({ type: "asset", assetId: row.bookmarkAssets.assetId, assetType: row.bookmarkAssets.assetType, + fileName: row.bookmarkAssets.fileName, }; } else { content = { type: "unknown" }; diff --git a/packages/trpc/types/bookmarks.ts b/packages/trpc/types/bookmarks.ts index 089007d2..cf9c2ddf 100644 --- a/packages/trpc/types/bookmarks.ts +++ b/packages/trpc/types/bookmarks.ts @@ -53,6 +53,30 @@ export const zBookmarkSchema = zBareBookmarkSchema.merge( ); export type ZBookmark = z.infer<typeof zBookmarkSchema>; +const zBookmarkTypeLinkSchema = zBareBookmarkSchema.merge( + z.object({ + tags: z.array(zBookmarkTagSchema), + content: zBookmarkedLinkSchema, + }), +); +export type ZBookmarkTypeLink = z.infer<typeof zBookmarkTypeLinkSchema>; + +const zBookmarkTypeTextSchema = zBareBookmarkSchema.merge( + z.object({ + tags: z.array(zBookmarkTagSchema), + content: zBookmarkedTextSchema, + }), +); +export type ZBookmarkTypeText = z.infer<typeof zBookmarkTypeTextSchema>; + +const zBookmarkTypeAssetSchema = zBareBookmarkSchema.merge( + z.object({ + tags: z.array(zBookmarkTagSchema), + content: zBookmarkedAssetSchema, + }), +); +export type ZBookmarkTypeAsset = z.infer<typeof zBookmarkTypeAssetSchema>; + // POST /v1/bookmarks export const zNewBookmarkRequestSchema = zBookmarkContentSchema; export type ZNewBookmarkRequest = z.infer<typeof zNewBookmarkRequestSchema>; |
