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:
@@ -269,6 +269,7 @@ func (s *EnterpriseSiteService) List(ctx context.Context) ([]EnterpriseSiteConne
|
||||
WHERE pr.tenant_id = $1
|
||||
AND pr.target_type = 'enterprise_site'
|
||||
AND pr.target_connection_id IS NOT NULL
|
||||
AND pr.deleted_at IS NULL
|
||||
ORDER BY pr.target_connection_id, pr.created_at DESC, pr.id DESC
|
||||
)
|
||||
SELECT
|
||||
@@ -1022,7 +1023,7 @@ func (s *EnterpriseSiteService) finishEnterprisePublishRecord(
|
||||
published_at = $5,
|
||||
error_message = $6,
|
||||
updated_at = NOW()
|
||||
WHERE id = $7 AND tenant_id = $8
|
||||
WHERE id = $7 AND tenant_id = $8 AND deleted_at IS NULL
|
||||
`, status, externalID, externalURL, nullableJSON(responsePayload), publishedAt, errorMessage, publishRecordID, tenantID); err != nil {
|
||||
return response.ErrInternal(50228, "enterprise_site_publish_record_update_failed", "企业站点发布结果更新失败")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user