aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/routers/bookmarks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/trpc/routers/bookmarks.ts')
-rw-r--r--packages/trpc/routers/bookmarks.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts
index 12ec9ccb..6ab863fb 100644
--- a/packages/trpc/routers/bookmarks.ts
+++ b/packages/trpc/routers/bookmarks.ts
@@ -259,6 +259,7 @@ function toZodSchema(bookmark: BookmarkQueryReturnType): ZBookmark {
assetId: asset.assetId,
fileName: asset.fileName,
sourceUrl: asset.sourceUrl,
+ size: assets.find((a) => a.id == asset.assetId)?.size,
};
break;
}
@@ -441,6 +442,7 @@ export const bookmarksAppRouter = router({
case BookmarkTypes.ASSET: {
await AssetPreprocessingQueue.enqueue({
bookmarkId: bookmark.id,
+ fixMode: false,
});
break;
}
@@ -830,6 +832,7 @@ export const bookmarksAppRouter = router({
assetType: bookmarkAssets.assetType,
fileName: bookmarkAssets.fileName,
sourceUrl: bookmarkAssets.sourceUrl ?? null,
+ size: null, // This will get filled in the asset loop
};
break;
}
@@ -881,6 +884,13 @@ export const bookmarksAppRouter = router({
}
acc[bookmarkId].content = content;
}
+ if (acc[bookmarkId].content.type == BookmarkTypes.ASSET) {
+ const content = acc[bookmarkId].content;
+ if (row.assets.id == content.assetId) {
+ // If this is the bookmark's main aset, caputure its size.
+ content.size = row.assets.size;
+ }
+ }
acc[bookmarkId].assets.push({
id: row.assets.id,
assetType: mapDBAssetTypeToUserType(row.assets.assetType),