app.bettersight.io/n8n/workflows/weekly_data_cleanup_cron.json

43 lines
1.5 KiB
JSON

{
"name": "Bettersight — Weekly Data Cleanup (Sunday 3am)",
"nodes": [
{
"parameters": {
"rule": {
"interval": [{ "field": "cronExpression", "expression": "0 3 * * 0" }]
}
},
"id": "schedule-trigger",
"name": "Schedule Trigger (Sunday 03:00)",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [0, 0]
},
{
"parameters": {
"method": "POST",
"url": "={{ $env.BETTERSIGHT_API_BASE_URL }}/internal/data-cleanup",
"sendHeaders": true,
"headerParameters": {
"parameters": [{ "name": "X-API-Key", "value": "={{ $env.API_SECRET_KEY }}" }]
}
},
"id": "data-cleanup",
"name": "POST /internal/data-cleanup",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [220, 0]
}
],
"connections": {
"Schedule Trigger (Sunday 03:00)": {
"main": [[{ "node": "POST /internal/data-cleanup", "type": "main", "index": 0 }]]
}
},
"active": false,
"settings": { "executionOrder": "v1" },
"meta": {
"description": "CLAUDE.md §22 DATA_RETENTION weekly cleanup — a single global call, not per-tenant, since the deletion sweep runs across all tenants' scrape_runs (>90 days), read alerts (>90 days), and price_history (>365 days) in one pass. All real logic lives in services/retention_service.py's run_weekly_cleanup(); this workflow only triggers it on schedule. Not yet imported/run against a live n8n instance."
}
}