{
  "name": "Vorlux AI | Full QA Pipeline",
  "nodes": [
    {
      "id": "2db1b6c9-d1df-4351-a92a-faa19f8f83de",
      "name": "Every 6h",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        220,
        300
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      }
    },
    {
      "id": "27e2d6bb-e6cd-446e-a287-9655b5dd7384",
      "name": "Fetch Unreviewed",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        460,
        300
      ],
      "parameters": {
        "method": "GET",
        "url": "={{$env.VORLUX_HUB_URL}}/api/blog/posts?unreviewed=true&limit=10",
        "options": {
          "timeout": 15000
        }
      },
      "notes": "Gets blog posts not yet QA reviewed"
    },
    {
      "id": "3d4f44ca-ab36-41b2-b949-6a33c23e5be1",
      "name": "Review Each",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        700,
        300
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const posts=$input.first().json.data||[];const results=[];for(const p of posts.slice(0,5)){const content=p.content||'';const wc=content.split(/\\s+/).length;const headers=(content.match(/^#{1,3}\\s/gm)||[]).length;const links=(content.match(/\\[.*?\\]\\(.*?\\)/g)||[]).length;const code=(content.match(/```/g)||[]).length/2;const lists=(content.match(/^[-*]\\s/gm)||[]).length;const hasSEO=!!(p.meta_title&&p.meta_description);const score=Math.round(((wc>=800?3:1)+(headers>=3?2:1)+(links>0?1:0)+(code>0?1:0)+(lists>=2?1:0)+(hasSEO?2:0))/10*100);results.push({id:p.id,title:p.title,wordCount:wc,headers,links,code,score,grade:score>=80?'A':score>=60?'B':score>=40?'C':'D'});}return [{json:{reviews:results,count:results.length}}];"
      },
      "notes": "Scores each post: word count, headers, links, code, SEO"
    },
    {
      "id": "b36180e5-0058-495e-afe3-b41508ece49d",
      "name": "Save Reviews",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        940,
        200
      ],
      "parameters": {
        "method": "POST",
        "url": "={{$env.VORLUX_HUB_URL}}/api/content/qa/batch",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({reviews: $json.reviews}) }}",
        "options": {
          "timeout": 15000
        }
      }
    },
    {
      "id": "494614b2-1f70-4148-97cd-37614c9f91a0",
      "name": "Report",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        940,
        400
      ],
      "parameters": {
        "method": "POST",
        "url": "={{$env.DISCORD_OPS_WEBHOOK}}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"embeds\":[{\"title\":\"\ud83d\udcca QA Pipeline: {{ $json.count }} Posts Reviewed\",\"description\":\"{{ $json.reviews.map(r => r.grade + \" \" + r.title + \" (\" + r.wordCount + \"w, \" + r.score + \"%)\").join(\"\\n\") }}\",\"color\":5793266}]}",
        "options": {
          "timeout": 10000
        }
      }
    }
  ],
  "connections": {
    "Every 6h": {
      "main": [
        [
          {
            "node": "Fetch Unreviewed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Unreviewed": {
      "main": [
        [
          {
            "node": "Review Each",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Review Each": {
      "main": [
        [
          {
            "node": "Save Reviews",
            "type": "main",
            "index": 0
          },
          {
            "node": "Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "saveExecutionProgress": true
  }
}