Files
n8n-backup-v2/workflows/gHvDsRXdGMxMZ4o6.json
2026-01-02 22:48:32 +00:00

326 lines
8.2 KiB
JSON

{
"id": "gHvDsRXdGMxMZ4o6",
"name": "EVE Bazaar Analyzer",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes"
}
]
}
},
"id": "Schedule Trigger",
"name": "Schedule Trigger",
"position": [
0,
80
],
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.3
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT * FROM character_bazaar_posts WHERE post_status IN ('new', 'updated') LIMIT 10",
"options": {}
},
"id": "Fetch Pending",
"name": "Fetch Pending",
"position": [
224,
80
],
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"credentials": {
"postgres": {
"id": "dsnKfvOBMkgU21Lt",
"name": "supabase postgres account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://esi.evetech.net/universe/ids",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Accept-Language",
"value": "en"
},
{
"name": "X-Compatibility-Date",
"value": "2025-11-06"
},
{
"name": "User-Agent",
"value": "n8n-workflow-testing"
}
]
},
"sendBody": true,
"contentType": "raw",
"body": "=[ \"{{ $json.author }}\" ] ",
"options": {}
},
"id": "Lookup Character ID",
"name": "Lookup Character ID",
"position": [
672,
144
],
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"continueOnFail": true
},
{
"parameters": {
"url": "=https://evewho.com/api/character/{{ $json.character_id }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "User-Agent",
"value": "n8n-workflow-testing"
}
]
},
"options": {}
},
"id": "Verify Character",
"name": "Verify Character",
"position": [
1344,
80
],
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"continueOnFail": true
},
{
"parameters": {},
"id": "Merge",
"name": "Merge",
"position": [
1104,
80
],
"type": "n8n-nodes-base.merge",
"typeVersion": 3
},
{
"parameters": {
"jsCode": "const items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n const json = item.json;\n const compliance_issues = [];\n let post_status = 'compliant';\n\n // Check if verification failed (Cloudflare or 404)\n if (json.error || !json.character_id) {\n compliance_issues.push(\"Character verification failed (Cloudflare)\");\n }\n\n // Generate SQL update query\n const issuesJson = JSON.stringify(compliance_issues);\n const now = new Date().toISOString();\n \n // Escape single quotes in JSON string for SQL\n const safeIssues = issuesJson.replace(/'/g, \"''\");\n \n let charIdUpdate = \"\";\n if (json.character_id) {\n charIdUpdate = `, character_id = ${json.character_id}`;\n }\n \n json.query = `UPDATE character_bazaar_posts SET compliance_issues = '${safeIssues}'::jsonb, last_reviewed_at = '${now}', post_status = '${post_status}'${charIdUpdate} WHERE id = '${json.id}'`;\n \n results.push({json});\n}\n\nreturn results;"
},
"id": "Simulate AI",
"name": "Simulate AI",
"position": [
1568,
80
],
"type": "n8n-nodes-base.code",
"typeVersion": 2
},
{
"parameters": {},
"id": "No Op",
"name": "No Op",
"position": [
1792,
80
],
"type": "n8n-nodes-base.noOp",
"typeVersion": 1
},
{
"parameters": {
"operation": "executeQuery",
"query": "={{ $json.query }}",
"options": {}
},
"id": "Update Post",
"name": "Update Post",
"position": [
2016,
80
],
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"credentials": {
"postgres": {
"id": "dsnKfvOBMkgU21Lt",
"name": "supabase postgres account"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.character_id }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "Check ID",
"name": "Check ID",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
448,
80
]
},
{
"parameters": {
"jsCode": "const results = [];\n// Access items from the \"False\" output (index 1) of the \"Check ID\" node\nconst originalItems = $('Check ID').all(1);\n\nfor (let i = 0; i < items.length; i++) {\n const lookupData = items[i].json;\n const original = originalItems[i] ? originalItems[i].json : {};\n \n let characterId = null;\n let characterName = null;\n\n // Extract ID and Name from the ESI response\n if (lookupData.characters && lookupData.characters.length > 0) {\n characterId = lookupData.characters[0].id;\n characterName = lookupData.characters[0].name;\n }\n \n results.push({\n json: {\n ...original,\n character_id: characterId,\n character_name: characterName\n }\n });\n}\n\nreturn results;"
},
"id": "Apply Lookup",
"name": "Apply Lookup",
"position": [
896,
144
],
"type": "n8n-nodes-base.code",
"typeVersion": 2
}
],
"connections": {
"Lookup Character ID": {
"main": [
[
{
"node": "Apply Lookup",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Verify Character",
"type": "main",
"index": 0
}
]
]
},
"No Op": {
"main": [
[
{
"index": 0,
"node": "Update Post",
"type": "main"
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"index": 0,
"node": "Fetch Pending",
"type": "main"
}
]
]
},
"Simulate AI": {
"main": [
[
{
"index": 0,
"node": "No Op",
"type": "main"
}
]
]
},
"Fetch Pending": {
"main": [
[
{
"node": "Check ID",
"type": "main",
"index": 0
}
]
]
},
"Check ID": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
],
[
{
"node": "Lookup Character ID",
"type": "main",
"index": 0
}
]
]
},
"Verify Character": {
"main": [
[
{
"node": "Simulate AI",
"type": "main",
"index": 0
}
]
]
},
"Apply Lookup": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"saveDataErrorExecution": "all",
"saveDataSuccessExecution": "all",
"saveManualExecutions": true,
"saveExecutionProgress": true,
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"triggerCount": 1,
"versionId": "ae0ae4fe-110e-4c9a-905e-328d85b371b0",
"owner": {
"type": "personal",
"projectId": "FeLO36wNUAcn61Wj",
"projectName": "Ben W <admin@ben.io>",
"personalEmail": "admin@ben.io"
},
"parentFolderId": "HWgaFb7kLF649L7l",
"isArchived": false
}