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
+12 -2
View File
@@ -35,6 +35,7 @@ import type {
CreatePublishBatchResponse,
CreatePublishJobRequest,
CreatePublishJobResponse,
DeletePublishRecordResponse,
DesktopAccountInfo,
DesktopClientDownloadableRelease,
DesktopClientDownloadableReleaseListResponse,
@@ -351,8 +352,6 @@ const currentBrandScopedPathPatterns = [
/^\/api\/tenant\/schedules(?:\/|$)/,
/^\/api\/tenant\/instant-tasks(?:\/|$)/,
/^\/api\/tenant\/publish-jobs(?:\/|$)/,
/^\/api\/tenant\/publish-records(?:\/|$)/,
/^\/api\/tenant\/publish-tasks\/[^/]+\/retry(?:\/|$)/,
/^\/api\/tenant\/enterprise-sites\/[^/]+\/publish(?:\/|$)/,
/^\/api\/tenant\/media-supply\/orders(?:\/|$)/,
/^\/api\/tenant\/prompt-rules(?:\/|$)/,
@@ -1396,6 +1395,12 @@ export const publishTasksApi = {
params,
})
},
cancel(taskId: string) {
return apiClient.post<unknown, { reason: string }>(
`/api/tenant/tasks/${encodeURIComponent(taskId)}/cancel`,
{ reason: 'tenant_cancelled_publish' },
)
},
retry(taskId: string) {
return apiClient.post<CreatePublishJobResponse>(
`/api/tenant/publish-tasks/${encodeURIComponent(taskId)}/retry`,
@@ -1409,6 +1414,11 @@ export const publishRecordsApi = {
params,
})
},
remove(recordId: number) {
return apiClient.remove<DeletePublishRecordResponse>(
`/api/tenant/publish-records/${encodeURIComponent(String(recordId))}`,
)
},
}
export const enterpriseSitesApi = {