feat: add brand asset cleanup worker and related functionality
Frontend CI / Frontend (push) Successful in 3m23s
Backend CI / Backend (push) Failing after 6m46s

- Implemented a new BrandAssetCleanupWorker to handle the cleanup of brand-related assets after a brand is deleted.
- Added SQL queries for cleaning up articles, keywords, questions, competitors, and monitoring data associated with a brand.
- Introduced a new API endpoint to delete publish records.
- Updated the router to include the new delete publish record endpoint.
- Added tests for the BrandAssetCleanupWorker to ensure proper functionality.
- Created migration scripts to support soft deletion of publish records and to add the brand asset cleanup scheduler job.
This commit is contained in:
2026-06-19 11:45:13 +08:00
parent 97ae601cfd
commit 6e0519a232
29 changed files with 1621 additions and 54 deletions
@@ -592,13 +592,13 @@ function handlePromptSaved(ruleId: number): void {
}
function toggleSchedulePublishAccount(account: PublishAccountCard): void {
if (!account.selectable) {
return
}
if (form.publishAccountIds.includes(account.id)) {
form.publishAccountIds = form.publishAccountIds.filter((id) => id !== account.id)
return
}
if (!account.selectable) {
return
}
form.publishAccountIds = [...form.publishAccountIds, account.id]
}
@@ -606,6 +606,10 @@ function isSchedulePublishAccountSelected(accountId: string): boolean {
return form.publishAccountIds.includes(accountId)
}
function canToggleSchedulePublishAccount(account: PublishAccountCard): boolean {
return account.selectable || isSchedulePublishAccountSelected(account.id)
}
function buildScheduleEnterpriseSiteTargets(): ScheduleEnterpriseSiteTarget[] {
return form.publishEnterpriseSiteIds
.map((siteId) => ({
@@ -1325,8 +1329,10 @@ function normalizeJsonRecord(value: Record<string, unknown>): Record<string, Jso
'generate-task-drawer__account--active': isSchedulePublishAccountSelected(
account.id,
),
'generate-task-drawer__account--disabled': !account.selectable,
'generate-task-drawer__account--disabled':
!canToggleSchedulePublishAccount(account),
}"
:aria-disabled="!canToggleSchedulePublishAccount(account)"
@click="toggleSchedulePublishAccount(account)"
>
<span class="generate-task-drawer__account-check">