From 2c27d91aaa582a7d54c8923dc77dbef41e12376e Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 5 Jun 2025 19:30:08 +0800 Subject: [PATCH] feat(mobile): show analytics in feed form --- .../src/modules/discover/DiscoverFeedCard.tsx | 2 +- apps/mobile/src/modules/feed/FollowFeed.tsx | 38 +- locales/app/en.json | 5 - locales/app/ja.json | 2 - locales/app/zh-CN.json | 5 - locales/app/zh-TW.json | 5 - locales/common/en.json | 5 + locales/common/ja.json | 2 + locales/common/zh-CN.json | 5 + locales/common/zh-TW.json | 5 + .../database/src/drizzle/0023_pink_namor.sql | 3 + .../src/drizzle/meta/0023_snapshot.json | 743 ++++++++++++++++++ .../database/src/drizzle/meta/_journal.json | 7 + .../database/src/drizzle/migrations.js | 2 + .../internal/database/src/schemas/index.ts | 3 + packages/internal/store/src/feed/store.ts | 14 +- 16 files changed, 823 insertions(+), 23 deletions(-) create mode 100644 packages/internal/database/src/drizzle/0023_pink_namor.sql create mode 100644 packages/internal/database/src/drizzle/meta/0023_snapshot.json diff --git a/apps/desktop/layer/renderer/src/modules/discover/DiscoverFeedCard.tsx b/apps/desktop/layer/renderer/src/modules/discover/DiscoverFeedCard.tsx index f9dea3b25..87b208e41 100644 --- a/apps/desktop/layer/renderer/src/modules/discover/DiscoverFeedCard.tsx +++ b/apps/desktop/layer/renderer/src/modules/discover/DiscoverFeedCard.tsx @@ -96,7 +96,7 @@ interface DiscoverFeedCardProps { export const DiscoverFeedCard: FC = memo( ({ item, onSuccess, className }) => { const numberFormatter = useMemo(() => new Intl.NumberFormat("en-US", {}), []) - const { t } = useTranslation() + const { t } = useTranslation("common") const isSubscribed = useIsSubscribed(item.feed?.id || item.list?.id || "") diff --git a/apps/mobile/src/modules/feed/FollowFeed.tsx b/apps/mobile/src/modules/feed/FollowFeed.tsx index 777e8f2e6..12cf90dad 100644 --- a/apps/mobile/src/modules/feed/FollowFeed.tsx +++ b/apps/mobile/src/modules/feed/FollowFeed.tsx @@ -16,12 +16,16 @@ import { NavigationBlurEffectHeaderView, SafeNavigationScrollView, } from "@/src/components/layouts/views/SafeNavigationScrollView" +import { RelativeDateTime } from "@/src/components/ui/datetime/RelativeDateTime" import { FormProvider } from "@/src/components/ui/form/FormProvider" import { FormLabel } from "@/src/components/ui/form/Label" import { FormSwitch } from "@/src/components/ui/form/Switch" import { TextField } from "@/src/components/ui/form/TextField" import { GroupedInsetListCard } from "@/src/components/ui/grouped/GroupedList" import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator" +import { SafeAlertCuteReIcon } from "@/src/icons/safe_alert_cute_re" +import { SafetyCertificateCuteReIcon } from "@/src/icons/safety_certificate_cute_re" +import { User3CuteReIcon } from "@/src/icons/user_3_cute_re" import { useCanDismiss, useNavigation } from "@/src/lib/navigation/hooks" import { useSetModalScreenOptions } from "@/src/lib/navigation/ScreenOptionsContext" import { FeedSummary } from "@/src/modules/discover/FeedSummary" @@ -37,9 +41,9 @@ const formSchema = z.object({ export function FollowFeed(props: { id: string }) { const { id } = props const feed = useFeed(id as string) - const { isLoading } = usePrefetchFeed(id as string, { enabled: !feed }) + usePrefetchFeed(id as string) - if (isLoading) { + if (!feed) { return ( @@ -172,7 +176,35 @@ function FollowImpl(props: { feedId: string }) { type: "feed", }, }} - /> + > + + {!!feed.subscriptionCount && ( + + + + {feed.subscriptionCount}{" "} + {tCommon("feed.follower", { count: feed.subscriptionCount })} + + + )} + {feed.updatesPerWeek ? ( + + + + {tCommon("feed.entry_week", { count: feed.updatesPerWeek })} + + + ) : feed.latestEntryPublishedAt ? ( + + + + {tCommon("feed.updated_at")} + + + + ) : null} + + {/* Group 2 */} diff --git a/locales/app/en.json b/locales/app/en.json index 49c56e964..cc5ef5e17 100644 --- a/locales/app/en.json +++ b/locales/app/en.json @@ -189,14 +189,9 @@ "entry_list_header.unread": "unread", "feed.actions.follow": "Follow", "feed.actions.followed": "Followed", - "feed.entry_week_one": "{{count}} entry/week", - "feed.entry_week_other": "{{count}} entries/week", - "feed.follower_one": "follower", - "feed.follower_other": "followers", "feed.followsAndFeeds": "{{subscriptionCount}} {{subscriptionNoun}} and {{feedsCount}} {{feedsNoun}} on {{appName}}", "feed.read_one": "read", "feed.read_other": "reads", - "feed.updated_at": "Updated", "feed_claim_modal.choose_verification_method": "There are three ways to choose from, you can choose one of them to verify.", "feed_claim_modal.claim_button": "Claim", "feed_claim_modal.content_instructions": "Copy the content below and post it to your latest RSS feed.", diff --git a/locales/app/ja.json b/locales/app/ja.json index fa8c1ed9f..abe4df6c0 100644 --- a/locales/app/ja.json +++ b/locales/app/ja.json @@ -160,8 +160,6 @@ "entry_list_header.switch_to_widemode": "ワイドモードに切り替え", "entry_list_header.unread": "未読", "feed.actions.followed": "フォロー済み", - "feed.follower_one": "フォロワー", - "feed.follower_other": "フォロワー", "feed.followsAndFeeds": "{{subscriptionCount}} {{subscriptionNoun}} と {{feedsCount}} {{feedsNoun}} on {{appName}}", "feed.read_one": "読む", "feed.read_other": "読む", diff --git a/locales/app/zh-CN.json b/locales/app/zh-CN.json index d8570719e..baecd6c79 100644 --- a/locales/app/zh-CN.json +++ b/locales/app/zh-CN.json @@ -188,14 +188,9 @@ "entry_list_header.unread": "未读", "feed.actions.follow": "订阅", "feed.actions.followed": "已订阅", - "feed.entry_week_one": "{{count}} 条目/周", - "feed.entry_week_other": "{{count}} 条目/周", - "feed.follower_one": "订阅者", - "feed.follower_other": "订阅者", "feed.followsAndFeeds": "在 {{appName}} 上有 {{subscriptionCount}} 个{{subscriptionNoun}}和 {{feedsCount}} 个{{feedsNoun}}", "feed.read_one": "阅读", "feed.read_other": "阅读", - "feed.updated_at": "更新于", "feed_claim_modal.choose_verification_method": "有三种认证方式,可任选其中一种进行认证。", "feed_claim_modal.claim_button": "认证", "feed_claim_modal.content_instructions": "复制以下内容,发布到需要认证的订阅源。", diff --git a/locales/app/zh-TW.json b/locales/app/zh-TW.json index e2895f5ce..82714a4c0 100644 --- a/locales/app/zh-TW.json +++ b/locales/app/zh-TW.json @@ -186,14 +186,9 @@ "entry_list_header.unread": "未讀", "feed.actions.follow": "跟隨", "feed.actions.followed": "已跟隨", - "feed.entry_week_one": "{{count}} 條目/週", - "feed.entry_week_other": "{{count}} 條目/週", - "feed.follower_one": "跟隨者", - "feed.follower_other": "跟隨者", "feed.followsAndFeeds": "在 {{appName}} 上有 {{subscriptionCount}} 個 {{subscriptionNoun}} 和 {{feedsCount}} 個 {{feedsNoun}}", "feed.read_one": "閱讀", "feed.read_other": "閱讀", - "feed.updated_at": "已更新", "feed_claim_modal.choose_verification_method": "有三種驗證方式,您可以選擇其中一種進行驗證。", "feed_claim_modal.claim_button": "認領", "feed_claim_modal.content_instructions": "複製以下內容,發佈到需要驗證的 RSS 摘要。", diff --git a/locales/common/en.json b/locales/common/en.json index 0938268e5..38991ffc4 100644 --- a/locales/common/en.json +++ b/locales/common/en.json @@ -23,6 +23,11 @@ "discover.category.traditional-media": "News", "discover.category.travel": "Travel", "discover.category.university": "University", + "feed.entry_week_one": "{{count}} entry/week", + "feed.entry_week_other": "{{count}} entries/week", + "feed.follower_one": "follower", + "feed.follower_other": "followers", + "feed.updated_at": "Updated", "feed_view_type.articles": "Articles", "feed_view_type.audios": "Audios", "feed_view_type.notifications": "Notifications", diff --git a/locales/common/ja.json b/locales/common/ja.json index 34a45075f..68a31d7d0 100644 --- a/locales/common/ja.json +++ b/locales/common/ja.json @@ -23,6 +23,8 @@ "discover.category.traditional-media": "ニュース", "discover.category.travel": "旅行", "discover.category.university": "大学", + "feed.follower_one": "フォロワー", + "feed.follower_other": "フォロワー", "feed_view_type.articles": "記事", "feed_view_type.audios": "オーディオ", "feed_view_type.notifications": "通知", diff --git a/locales/common/zh-CN.json b/locales/common/zh-CN.json index b876fe862..8fe956ac8 100644 --- a/locales/common/zh-CN.json +++ b/locales/common/zh-CN.json @@ -23,6 +23,11 @@ "discover.category.traditional-media": "传统媒体", "discover.category.travel": "出行旅游", "discover.category.university": "大学通知", + "feed.entry_week_one": "{{count}} 条目/周", + "feed.entry_week_other": "{{count}} 条目/周", + "feed.follower_one": "订阅者", + "feed.follower_other": "订阅者", + "feed.updated_at": "更新于", "feed_view_type.articles": "文章", "feed_view_type.audios": "音频", "feed_view_type.notifications": "通知", diff --git a/locales/common/zh-TW.json b/locales/common/zh-TW.json index 665056115..a4cf6e25a 100644 --- a/locales/common/zh-TW.json +++ b/locales/common/zh-TW.json @@ -23,6 +23,11 @@ "discover.category.traditional-media": "傳統媒體", "discover.category.travel": "出行旅遊", "discover.category.university": "大學資訊", + "feed.entry_week_one": "{{count}} 條目/週", + "feed.entry_week_other": "{{count}} 條目/週", + "feed.follower_one": "跟隨者", + "feed.follower_other": "跟隨者", + "feed.updated_at": "已更新", "feed_view_type.articles": "文章", "feed_view_type.audios": "音訊", "feed_view_type.notifications": "通知", diff --git a/packages/internal/database/src/drizzle/0023_pink_namor.sql b/packages/internal/database/src/drizzle/0023_pink_namor.sql new file mode 100644 index 000000000..6352e7202 --- /dev/null +++ b/packages/internal/database/src/drizzle/0023_pink_namor.sql @@ -0,0 +1,3 @@ +ALTER TABLE `feeds` ADD `subscription_count` integer;--> statement-breakpoint +ALTER TABLE `feeds` ADD `updates_per_week` integer;--> statement-breakpoint +ALTER TABLE `feeds` ADD `latest_entry_published_at` text; \ No newline at end of file diff --git a/packages/internal/database/src/drizzle/meta/0023_snapshot.json b/packages/internal/database/src/drizzle/meta/0023_snapshot.json new file mode 100644 index 000000000..bd82552b2 --- /dev/null +++ b/packages/internal/database/src/drizzle/meta/0023_snapshot.json @@ -0,0 +1,743 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "61f98b38-f03a-4f57-beb4-8c219ac1331c", + "prevId": "52d21c45-d498-48b7-8c8c-3775d72d16a4", + "tables": { + "collections": { + "name": "collections", + "columns": { + "feed_id": { + "name": "feed_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entry_id": { + "name": "entry_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "view": { + "name": "view", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "entries": { + "name": "entries", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_content": { + "name": "source_content", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "guid": { + "name": "guid", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author": { + "name": "author", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "author_url": { + "name": "author_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "author_avatar": { + "name": "author_avatar", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "inserted_at": { + "name": "inserted_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "published_at": { + "name": "published_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media": { + "name": "media", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "categories": { + "name": "categories", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attachments": { + "name": "attachments", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "extra": { + "name": "extra", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "feed_id": { + "name": "feed_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "inbox_handle": { + "name": "inbox_handle", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "read": { + "name": "read", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sources": { + "name": "sources", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "settings": { + "name": "settings", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "feeds": { + "name": "feeds", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error_at": { + "name": "error_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "site_url": { + "name": "site_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owner_user_id": { + "name": "owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "subscription_count": { + "name": "subscription_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updates_per_week": { + "name": "updates_per_week", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "latest_entry_published_at": { + "name": "latest_entry_published_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "images": { + "name": "images", + "columns": { + "url": { + "name": "url", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "colors": { + "name": "colors", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "(CURRENT_TIMESTAMP)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "inboxes": { + "name": "inboxes", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lists": { + "name": "lists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feed_ids": { + "name": "feed_ids", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "view": { + "name": "view", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fee": { + "name": "fee", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owner_user_id": { + "name": "owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "subscription_count": { + "name": "subscription_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purchase_amount": { + "name": "purchase_amount", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "subscriptions": { + "name": "subscriptions", + "columns": { + "feed_id": { + "name": "feed_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "inbox_id": { + "name": "inbox_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "view": { + "name": "view", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_private": { + "name": "is_private", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "summaries": { + "name": "summaries", + "columns": { + "entry_id": { + "name": "entry_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "readability_summary": { + "name": "readability_summary", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "unq": { + "name": "unq", + "columns": ["entry_id", "language"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "translations": { + "name": "translations", + "columns": { + "entry_id": { + "name": "entry_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "readability_content": { + "name": "readability_content", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "translation-unique-index": { + "name": "translation-unique-index", + "columns": ["entry_id", "language"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "unread": { + "name": "unread", + "columns": { + "subscription_id": { + "name": "subscription_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "handle": { + "name": "handle", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_me": { + "name": "is_me", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email_verified": { + "name": "email_verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} diff --git a/packages/internal/database/src/drizzle/meta/_journal.json b/packages/internal/database/src/drizzle/meta/_journal.json index 60584dcd8..0b42f3112 100644 --- a/packages/internal/database/src/drizzle/meta/_journal.json +++ b/packages/internal/database/src/drizzle/meta/_journal.json @@ -162,6 +162,13 @@ "when": 1748331571730, "tag": "0022_tiny_northstar", "breakpoints": true + }, + { + "idx": 23, + "version": "6", + "when": 1749121539199, + "tag": "0023_pink_namor", + "breakpoints": true } ] } diff --git a/packages/internal/database/src/drizzle/migrations.js b/packages/internal/database/src/drizzle/migrations.js index 924b0da3d..998be81fd 100644 --- a/packages/internal/database/src/drizzle/migrations.js +++ b/packages/internal/database/src/drizzle/migrations.js @@ -23,6 +23,7 @@ import m0019 from "./0019_wonderful_shape.sql" import m0020 from "./0020_little_marauders.sql" import m0021 from "./0021_wakeful_onslaught.sql" import m0022 from "./0022_tiny_northstar.sql" +import m0023 from "./0023_pink_namor.sql" import journal from "./meta/_journal.json" export default { @@ -51,5 +52,6 @@ export default { m0020, m0021, m0022, + m0023, }, } diff --git a/packages/internal/database/src/schemas/index.ts b/packages/internal/database/src/schemas/index.ts index 75183b915..1a95abd93 100644 --- a/packages/internal/database/src/schemas/index.ts +++ b/packages/internal/database/src/schemas/index.ts @@ -16,6 +16,9 @@ export const feedsTable = sqliteTable("feeds", { siteUrl: text("site_url"), ownerUserId: text("owner_user_id"), errorMessage: text("error_message"), + subscriptionCount: integer("subscription_count"), + updatesPerWeek: integer("updates_per_week"), + latestEntryPublishedAt: text("latest_entry_published_at"), }) export const subscriptionsTable = sqliteTable("subscriptions", { diff --git a/packages/internal/store/src/feed/store.ts b/packages/internal/store/src/feed/store.ts index ed8572961..1998385d1 100644 --- a/packages/internal/store/src/feed/store.ts +++ b/packages/internal/store/src/feed/store.ts @@ -76,7 +76,12 @@ class FeedSyncServices { const nonce = Math.random().toString(36).slice(2, 15) - const finalData = res.data.feed as FeedModel + const finalData = { + ...res.data.feed, + updatesPerWeek: res.data.analytics?.updatesPerWeek, + subscriptionCount: res.data.analytics?.subscriptionCount, + latestEntryPublishedAt: res.data.analytics?.latestEntryPublishedAt, + } as FeedModel if (!finalData.id) { finalData["nonce"] = nonce } @@ -94,7 +99,12 @@ class FeedSyncServices { const nonce = Math.random().toString(36).slice(2, 15) - const finalData = res.data.feed as FeedModel + const finalData = { + ...res.data.feed, + updatesPerWeek: res.data.analytics?.updatesPerWeek, + subscriptionCount: res.data.analytics?.subscriptionCount, + latestEntryPublishedAt: res.data.analytics?.latestEntryPublishedAt, + } as FeedModel if (!finalData.id) { finalData["nonce"] = nonce finalData["id"] = nonce