feat: add brand asset cleanup worker and related functionality
- 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:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user