aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/lib/attachments.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/trpc/lib/attachments.ts')
-rw-r--r--packages/trpc/lib/attachments.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/trpc/lib/attachments.ts b/packages/trpc/lib/attachments.ts
index 25d9be94..f3170c22 100644
--- a/packages/trpc/lib/attachments.ts
+++ b/packages/trpc/lib/attachments.ts
@@ -9,6 +9,7 @@ import {
export function mapDBAssetTypeToUserType(assetType: AssetTypes): ZAssetType {
const map: Record<AssetTypes, z.infer<typeof zAssetTypesSchema>> = {
[AssetTypes.LINK_SCREENSHOT]: "screenshot",
+ [AssetTypes.LINK_PDF]: "pdf",
[AssetTypes.ASSET_SCREENSHOT]: "assetScreenshot",
[AssetTypes.LINK_FULL_PAGE_ARCHIVE]: "fullPageArchive",
[AssetTypes.LINK_PRECRAWLED_ARCHIVE]: "precrawledArchive",
@@ -17,6 +18,7 @@ export function mapDBAssetTypeToUserType(assetType: AssetTypes): ZAssetType {
[AssetTypes.LINK_HTML_CONTENT]: "linkHtmlContent",
[AssetTypes.BOOKMARK_ASSET]: "bookmarkAsset",
[AssetTypes.USER_UPLOADED]: "userUploaded",
+ [AssetTypes.AVATAR]: "avatar",
[AssetTypes.BACKUP]: "unknown", // Backups are not displayed as regular assets
[AssetTypes.UNKNOWN]: "bannerImage",
};
@@ -28,6 +30,7 @@ export function mapSchemaAssetTypeToDB(
): AssetTypes {
const map: Record<ZAssetType, AssetTypes> = {
screenshot: AssetTypes.LINK_SCREENSHOT,
+ pdf: AssetTypes.LINK_PDF,
assetScreenshot: AssetTypes.ASSET_SCREENSHOT,
fullPageArchive: AssetTypes.LINK_FULL_PAGE_ARCHIVE,
precrawledArchive: AssetTypes.LINK_PRECRAWLED_ARCHIVE,
@@ -36,6 +39,7 @@ export function mapSchemaAssetTypeToDB(
bookmarkAsset: AssetTypes.BOOKMARK_ASSET,
linkHtmlContent: AssetTypes.LINK_HTML_CONTENT,
userUploaded: AssetTypes.USER_UPLOADED,
+ avatar: AssetTypes.AVATAR,
unknown: AssetTypes.UNKNOWN,
};
return map[assetType];
@@ -44,6 +48,7 @@ export function mapSchemaAssetTypeToDB(
export function humanFriendlyNameForAssertType(type: ZAssetType) {
const map: Record<ZAssetType, string> = {
screenshot: "Screenshot",
+ pdf: "PDF",
assetScreenshot: "Asset Screenshot",
fullPageArchive: "Full Page Archive",
precrawledArchive: "Precrawled Archive",
@@ -52,6 +57,7 @@ export function humanFriendlyNameForAssertType(type: ZAssetType) {
bookmarkAsset: "Bookmark Asset",
linkHtmlContent: "HTML Content",
userUploaded: "User Uploaded File",
+ avatar: "Avatar",
unknown: "Unknown",
};
return map[type];
@@ -60,6 +66,7 @@ export function humanFriendlyNameForAssertType(type: ZAssetType) {
export function isAllowedToAttachAsset(type: ZAssetType) {
const map: Record<ZAssetType, boolean> = {
screenshot: true,
+ pdf: true,
assetScreenshot: true,
fullPageArchive: false,
precrawledArchive: true,
@@ -68,6 +75,7 @@ export function isAllowedToAttachAsset(type: ZAssetType) {
bookmarkAsset: false,
linkHtmlContent: false,
userUploaded: true,
+ avatar: false,
unknown: false,
};
return map[type];
@@ -76,6 +84,7 @@ export function isAllowedToAttachAsset(type: ZAssetType) {
export function isAllowedToDetachAsset(type: ZAssetType) {
const map: Record<ZAssetType, boolean> = {
screenshot: true,
+ pdf: true,
assetScreenshot: true,
fullPageArchive: true,
precrawledArchive: true,
@@ -84,6 +93,7 @@ export function isAllowedToDetachAsset(type: ZAssetType) {
bookmarkAsset: false,
linkHtmlContent: false,
userUploaded: true,
+ avatar: false,
unknown: false,
};
return map[type];