From b147c8e5df75bdeafb1f0eeb2e6ce08e0dec7e37 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 5 Oct 2024 18:16:19 +0000 Subject: feature: Persevere the source URL of clipped texts from the extension. Fixes #448 --- packages/trpc/routers/bookmarks.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'packages/trpc') diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts index 9b23c88e..44ec6d7a 100644 --- a/packages/trpc/routers/bookmarks.ts +++ b/packages/trpc/routers/bookmarks.ts @@ -194,7 +194,11 @@ function toZodSchema(bookmark: BookmarkQueryReturnType): ZBookmark { }; break; case BookmarkTypes.TEXT: - content = { type: bookmark.type, text: text.text ?? "" }; + content = { + type: bookmark.type, + text: text.text ?? "", + sourceUrl: text.sourceUrl, + }; break; case BookmarkTypes.ASSET: content = { @@ -276,12 +280,17 @@ export const bookmarksAppRouter = router({ const text = ( await tx .insert(bookmarkTexts) - .values({ id: bookmark.id, text: input.text }) + .values({ + id: bookmark.id, + text: input.text, + sourceUrl: input.sourceUrl, + }) .returning() )[0]; content = { type: BookmarkTypes.TEXT, text: text.text ?? "", + sourceUrl: text.sourceUrl, }; break; } @@ -597,6 +606,7 @@ export const bookmarksAppRouter = router({ content = { type: row.bookmarksSq.type, text: row.bookmarkTexts?.text ?? "", + sourceUrl: row.bookmarkTexts?.sourceUrl ?? null, }; break; } @@ -607,6 +617,7 @@ export const bookmarksAppRouter = router({ assetId: bookmarkAssets.assetId, assetType: bookmarkAssets.assetType, fileName: bookmarkAssets.fileName, + sourceUrl: bookmarkAssets.sourceUrl ?? null, }; break; } -- cgit v1.2.3-70-g09d2