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
+9 -3
View File
@@ -1422,13 +1422,17 @@ export interface PromptRuleStatusRequest {
export interface ScheduleTask {
id: number;
workspace_id: number | null;
prompt_rule_id: number;
prompt_rule_name: string | null;
brand_id: number | null;
brand_name: string | null;
name: string;
cron_expr: string;
target_platform: string | null;
auto_publish: boolean;
publish_account_ids: string[];
cover_asset_url: string | null;
cover_image_asset_id: number | null;
enable_web_search: boolean;
generate_count: number;
start_at: string | null;
@@ -1444,7 +1448,10 @@ export interface ScheduleTaskRequest {
brand_id?: number | null;
name: string;
cron_expr: string;
target_platform?: string;
auto_publish?: boolean;
publish_account_ids?: string[];
cover_asset_url?: string | null;
cover_image_asset_id?: number | null;
enable_web_search?: boolean;
generate_count?: number;
start_at?: string;
@@ -1475,7 +1482,6 @@ export interface ScheduleTaskStatusRequest {
export interface GenerateFromRuleRequest {
prompt_rule_id: number;
brand_id?: number;
target_platform?: string;
extra_params?: Record<string, JsonValue>;
}