{
  "id": "piUF19ytLjMdvnAI",
  "createdAt": "2023-12-14T19:39:19.043Z",
  "updatedAt": "2023-12-14T20:08:34.605Z",
  "name": "actualiza nombres empresa segun kimchi",
  "active": true,
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 25
            }
          ]
        }
      },
      "id": "96e94744-79fd-4085-8c35-331cb4211f93",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        540,
        520
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "select * from api_registry_common.core_enterprise ce  where document_number in({{`'`}}{{$input.first().json.ids}}{{`'`}})",
        "options": {}
      },
      "id": "813f231e-b75d-4384-b7bf-9b5b5de1d511",
      "name": "MySQL",
      "type": "n8n-nodes-base.mySql",
      "typeVersion": 2.1,
      "position": [
        1320,
        520
      ],
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconst querys =[]\nfor (const item of $input.all()) {\n    querys.push({q:`update empresas set razon_social='${item.json.business_name}' where numero_identificador ='${item.json.document_number}'`}) ;\n}\n\nreturn querys;"
      },
      "id": "53bb62f4-cc4b-4556-b56f-ea8251a89466",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1560,
        380
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "{{ $input.item.json.q }}",
        "options": {}
      },
      "id": "b7080dbe-0cda-4a68-942d-529104a8702e",
      "name": "Postgres",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.2,
      "position": [
        1780,
        580
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "continueOnFail": true
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "select razon_social,numero_identificador from empresas e \ninner join empresas_pais_links epl on e.id =epl.empresa_id \ninner join paises p on epl.pais_id =p.id and p.iso_code ='CL'\nwhere  tipo_participante ='JURIDICA'",
        "options": {}
      },
      "id": "a350c317-9500-46ef-a90b-8dacdf897080",
      "name": "Postgres1",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.2,
      "position": [
        780,
        520
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet nums=[]\nfor (const item of $input.all()) {\n  nums.push(item.json.numero_identificador)\n}\n\nreturn {ids: nums.join(\"','\")};"
      },
      "id": "d6602a8d-a669-4e0c-8e13-0301ee07b655",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1040,
        520
      ]
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Postgres1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MySQL": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Postgres",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres1": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "MySQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": {
    "node:Schedule Trigger": {
      "recurrencyRules": []
    }
  },
  "versionId": "2fb2ebe5-9b03-4b10-96bb-a1ad8ee9176e",
  "triggerCount": 1,
  "tags": []
}