Compare commits

..

No commits in common. "b4648db5f6940d860af1ddb92ae4232c5018e233" and "f344721a9e7e696e5ec3a39c570ac1b8c4f2c43b" have entirely different histories.

2 changed files with 44 additions and 143 deletions

View File

@ -25,7 +25,13 @@
},
"IF": {
"main": [
[]
[
{
"node": "Postgres1",
"type": "main",
"index": 0
}
]
]
},
"Split Response Into Orders": {
@ -48,7 +54,7 @@
"main": [
[
{
"node": "Merge1",
"node": "Set Platform Ids",
"type": "main",
"index": 0
}
@ -95,49 +101,11 @@
"node": "Postgres",
"type": "main",
"index": 0
},
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "Item Lists",
"type": "main",
"index": 0
}
]
]
},
"Item Lists": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Postgres2",
"type": "main",
"index": 0
}
]
]
},
"Postgres2": {
"Set Platform Ids": {
"main": [
[
{
@ -235,9 +203,7 @@
"value": {
"product_id": "={{ $json.Product.EAN }}",
"quantity": "={{ $json.Quantity }}",
"price_each": "={{ $json.TotalPrice / $json.Quantity}}",
"order_detail_id": 0,
"order_id": 0
"price_each": "={{ $json.TotalPrice / $json.Quantity}}"
},
"matchingColumns": [],
"schema": [
@ -295,8 +261,8 @@
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.3,
"position": [
2600,
-1580
2020,
-1320
],
"credentials": {
"postgres": {
@ -372,7 +338,7 @@
"conditions": {
"boolean": [
{
"value1": "={{ $json }} {{ $json.product_ean }}",
"value1": "={{ $json.Product.EAN }}",
"operation": "notEqual",
"value2": "={{ null }}"
}
@ -384,8 +350,8 @@
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
2320,
-1280
1760,
-1300
]
},
{
@ -407,9 +373,8 @@
"operation": "upsert",
"schema": {
"__rl": true,
"value": "public",
"mode": "list",
"cachedResultName": "public"
"value": "public"
},
"table": {
"__rl": true,
@ -421,15 +386,22 @@
"mappingMode": "defineBelow",
"value": {
"order_id": "={{ $json.order_hash }}",
"platform_id": "={{ $json.platform }}",
"customer_id": "={{ $json.Customer.Number }}",
"order_ref": "={{ $json.OrderNumber }}",
"order_date": "={{ $json.CreatedAt.toDate().format(\"yyyyMMdd\") }}",
"order_ref": "={{ $json.OrderNumber }}"
"customer_id": "={{ $json.Customer.Number }}",
"platform_id": "={{ \nswitch ($json[\"ApiAccountName\"]) {\n case 'Otto':\n $json.platform = 6;\n default:\n $json.platform = 1;\n}\n}}"
},
"matchingColumns": [
"order_id"
],
"matchingColumns": [],
"schema": [
{
"id": "order_id",
"displayName": "order_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "order_ref",
"displayName": "order_ref",
@ -467,14 +439,13 @@
"canBeUsedToMatch": false
},
{
"id": "order_id",
"displayName": "order_id",
"required": true,
"id": "md5_hash",
"displayName": "md5_hash",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
"canBeUsedToMatch": false
}
]
},
@ -498,7 +469,8 @@
{
"parameters": {
"value": "={{ $json.OrderNumber.concat($json.CreatedAt.toDate().format(\"yyyy-MM-d\")) }}",
"dataPropertyName": "=order_hash"
"dataPropertyName": "=order_hash",
"encoding": "base64"
},
"id": "67fd82c6-055a-41d7-bc5e-ca727b0f9777",
"name": "Crypto",
@ -537,90 +509,19 @@
-1320
]
},
{
"parameters": {
"mode": "chooseBranch",
"output": "input2"
},
"id": "5d30f116-d392-4a34-9977-c9cb1bcaae07",
"name": "Merge1",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.1,
"position": [
1300,
-1100
]
},
{
"parameters": {
"fieldToSplitOut": "OrderItems",
"include": "selectedOtherFields",
"fieldsToInclude": "order_hash",
"options": {}
},
"id": "dc3a5418-691f-42a9-b09f-bb4c9d0e2155",
"name": "Item Lists",
"id": "48b91734-2dec-494e-8a8b-d260e5a5ff40",
"name": "Set Platform Ids",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 3,
"position": [
1520,
-1100
1320,
-1320
]
},
{
"parameters": {
"language": "python",
"pythonCode": "# Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor item in _input.all():\n if item.json.OrderItems.Product.EAN is None:\n item.json.OrderItems.Product.EAN = \"1111111111111\"\n item.json.OrderItems.Product.order_detail_sku = item.json.OrderItems.Product.SKU\nreturn _input.all()\n"
},
"id": "2b2f4265-e3af-444e-81d6-61c976ead182",
"name": "Code1",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1740,
-1100
]
},
{
"parameters": {
"operation": "select",
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"table": {
"__rl": true,
"value": "dim_products",
"mode": "list",
"cachedResultName": "dim_products"
},
"limit": 1,
"where": {
"values": [
{
"column": "product_ean",
"value": "={{ $json.OrderItems.Product.EAN }}"
}
]
},
"options": {}
},
"id": "54832aff-c8aa-476e-89ce-762f1d037ed3",
"name": "Postgres2",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.3,
"position": [
1960,
-1100
],
"alwaysOutputData": true,
"credentials": {
"postgres": {
"id": "JW5wwsSY4obQbCBb",
"name": "Postgres - warehouse"
}
}
}
],
"pinData": {},
@ -630,6 +531,6 @@
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2023-12-12T14:20:06.000Z",
"versionId": "bb86d85c-7be5-4ba4-aa35-59959e7386c3"
"updatedAt": "2023-12-12T09:52:19.000Z",
"versionId": "0e731bc6-faf1-4e5e-a83e-f8dabe7f704d"
}

View File

@ -474,13 +474,13 @@
"staticData": {
"node:Gmail Trigger": {
"possibleDuplicates": [
"18c5e7bbb1dc101f"
"18c5d25096d07c29"
],
"lastTimeChecked": 1702392204
"lastTimeChecked": 1702369757
}
},
"tags": [],
"triggerCount": 1,
"updatedAt": "2023-12-12T14:44:37.000Z",
"updatedAt": "2023-12-12T08:29:37.000Z",
"versionId": "d5336b9a-260a-4f88-862e-edbbb760acb2"
}