feat(schedule-tasks): support auto-publish via media accounts

Replace the legacy target_platform string on schedule tasks with a
workspace-aware auto-publish payload (auto_publish + publish_account_ids
JSONB + cover_asset_url + cover_image_asset_id) and migrate the schema,
sqlc queries, generated models, domain struct, ScheduleTaskService DTOs,
and dispatch worker to round-trip the new fields. PromptRuleGeneration
gains a WithPublishJobService hook so executeGeneration can enqueue an
auto-publish job once the article is ready, and worker-generate wires
the publish-job service in. On the admin-web side, extract
PublishArticleModal's account-card builders into a shared
publish-account-cards module, rebuild GenerateTaskDrawer's schedule
mode around account selection plus a CoverPickerModal, and surface the
new "auto publish" column on ScheduleTaskTab. Shared types and i18n
strings cover the new fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 01:32:19 +08:00
parent c9267d2fae
commit 6e6e19cccb
22 changed files with 1380 additions and 603 deletions
+15 -1
View File
@@ -1254,10 +1254,20 @@ const enUS = {
platformUnauthorized: "Unauthorized",
platformEmptyTitle: "No publish platforms",
platformEmptyHint: "No platform data is available yet. Please verify the Media Management setup first.",
publishSection: "Publish Settings",
autoPublish: "Auto publish",
autoPublishHint: "When enabled, scheduled articles enter the publish queue after generation.",
publishAccounts: "Media accounts",
publishAccountsHint: "Choose specific accounts. Offline clients queue first and continue after reconnecting.",
publishAccountEmptyTitle: "No media accounts",
publishAccountEmptyHint: "Bind media accounts in the desktop client before configuring auto publish.",
cover: "Cover image",
coverHint: "Keep the cover clear, complete, and visually polished.",
scheduleCoverHint: "Cover is off by default. Enable it to save a cover to generated articles for publishing.",
scheduleCoverRequiredHint: "A selected account platform requires a cover image before publishing.",
coverUpload: "Upload cover image",
coverUploadHint: "Local preview only for now",
scheduleCoverUploadHint: "Choose from local files or the asset library",
scheduleTime: "Schedule article generation",
scheduleEveryDay: "Every day",
enableWebSearch: "Enable web search for generation",
@@ -1276,7 +1286,9 @@ const enUS = {
name: "Task name",
rule: "Prompt rule",
cron: "Frequency",
platform: "Target platform",
autoPublish: "Auto publish",
manualPublish: "Manual publish",
autoPublishAccountCount: "Auto · {count} accounts",
nextRun: "Next run",
startAt: "Start time",
endAt: "End time",
@@ -1341,6 +1353,8 @@ const enUS = {
missingPromptRule: "Choose a prompt first.",
invalidGenerateCount: "Article count must be at least 1.",
invalidScheduleTime: "Choose a valid schedule time.",
missingPublishAccounts: "Choose at least one media account when auto publish is enabled.",
missingScheduleCover: "A selected media account platform requires a cover image.",
missingPromptName: "Enter a prompt name first.",
missingPromptContent: "Enter prompt content first.",
},