aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-10-05 18:16:19 +0000
committerMohamedBassem <me@mbassem.com>2024-10-05 18:16:46 +0000
commitb147c8e5df75bdeafb1f0eeb2e6ce08e0dec7e37 (patch)
tree1bfae4f49f8aeaf3870573831fdb62921ec38dd4 /packages/trpc
parentf1c956a361539592d00836488181b69218798600 (diff)
downloadkarakeep-b147c8e5df75bdeafb1f0eeb2e6ce08e0dec7e37.tar.zst
feature: Persevere the source URL of clipped texts from the extension.
Fixes #448
Diffstat (limited to 'packages/trpc')
-rw-r--r--packages/trpc/routers/bookmarks.ts15
1 files changed, 13 insertions, 2 deletions
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;
}