aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/db/schema.ts15
-rw-r--r--packages/trpc/routers/bookmarks.ts6
2 files changed, 6 insertions, 15 deletions
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index 6dacdec6..540c4c82 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -649,18 +649,9 @@ export const bookmarkRelations = relations(bookmarks, ({ many, one }) => ({
fields: [bookmarks.userId],
references: [users.id],
}),
- link: one(bookmarkLinks, {
- fields: [bookmarks.id],
- references: [bookmarkLinks.id],
- }),
- text: one(bookmarkTexts, {
- fields: [bookmarks.id],
- references: [bookmarkTexts.id],
- }),
- asset: one(bookmarkAssets, {
- fields: [bookmarks.id],
- references: [bookmarkAssets.id],
- }),
+ link: one(bookmarkLinks),
+ text: one(bookmarkTexts),
+ asset: one(bookmarkAssets),
tagsOnBookmarks: many(tagsOnBookmarks),
bookmarksInLists: many(bookmarksInLists),
assets: many(assets),
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts
index 9aa9ec1e..ef6ce396 100644
--- a/packages/trpc/routers/bookmarks.ts
+++ b/packages/trpc/routers/bookmarks.ts
@@ -187,7 +187,7 @@ async function toZodSchema(
let content: ZBookmarkContent = {
type: BookmarkTypes.UNKNOWN,
};
- if (bookmark.link) {
+ if (link) {
content = {
type: BookmarkTypes.LINK,
screenshotAssetId: assets.find(
@@ -219,7 +219,7 @@ async function toZodSchema(
dateModified: link.dateModified,
};
}
- if (bookmark.text) {
+ if (text) {
content = {
type: BookmarkTypes.TEXT,
// It's ok to include the text content as it's usually not big and is used to render the text bookmark card.
@@ -227,7 +227,7 @@ async function toZodSchema(
sourceUrl: text.sourceUrl,
};
}
- if (bookmark.asset) {
+ if (asset) {
content = {
type: BookmarkTypes.ASSET,
assetType: asset.assetType,