563 lines
13 KiB
JSON
563 lines
13 KiB
JSON
{
|
|
"id": "v3KQi4UoMlhH7JIW",
|
|
"name": "MAM Followed Series Sync",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "hours",
|
|
"hoursInterval": 24
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"id": "schedule-daily",
|
|
"name": "Daily at 3 AM",
|
|
"position": [
|
|
-256,
|
|
160
|
|
],
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.2
|
|
},
|
|
{
|
|
"parameters": {
|
|
"workflowId": {
|
|
"__rl": true,
|
|
"mode": "id",
|
|
"value": "0gxdxCdYQ7oXk7gC"
|
|
},
|
|
"options": {
|
|
"waitForSubWorkflow": true
|
|
}
|
|
},
|
|
"id": "call-enricher",
|
|
"name": "Call MAM Series Enricher",
|
|
"position": [
|
|
1088,
|
|
-112
|
|
],
|
|
"type": "n8n-nodes-base.executeWorkflow",
|
|
"typeVersion": 1.1,
|
|
"alwaysOutputData": true,
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"version": 2,
|
|
"leftValue": "",
|
|
"caseSensitive": true,
|
|
"typeValidation": "strict"
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "c1",
|
|
"leftValue": "={{ $json.mam_series_id }}",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "notEmpty",
|
|
"singleValue": true
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "enrichment-successful",
|
|
"name": "Enrichment Successful?",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
1312,
|
|
-112
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"options": {
|
|
"reset": false
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.splitInBatches",
|
|
"typeVersion": 3,
|
|
"position": [
|
|
640,
|
|
160
|
|
],
|
|
"id": "3114a985-aaff-49fd-9696-9b71a1cf268a",
|
|
"name": "Loop Over Items"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "executeQuery",
|
|
"query": "SELECT DISTINCT series_name \nFROM smb_general_books \nWHERE series_name IS NOT NULL \n AND series_name != ''\nORDER BY series_name ASC;",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
-32,
|
|
208
|
|
],
|
|
"id": "45b4c538-fd2b-4cfa-8482-b14337a53042",
|
|
"name": "select unique series",
|
|
"notesInFlow": true,
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "9grzZwW7Br6SzdV8",
|
|
"name": "n8n-media"
|
|
}
|
|
},
|
|
"notes": "from smb_ database"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "select",
|
|
"schema": {
|
|
"__rl": true,
|
|
"value": "public",
|
|
"mode": "list",
|
|
"cachedResultName": "public"
|
|
},
|
|
"table": {
|
|
"__rl": true,
|
|
"value": "followed_series",
|
|
"mode": "list",
|
|
"cachedResultName": "followed_series"
|
|
},
|
|
"returnAll": true,
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
-32,
|
|
16
|
|
],
|
|
"id": "d93903aa-c756-4955-ad05-1c4a98ef7621",
|
|
"name": "select followed series",
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "9grzZwW7Br6SzdV8",
|
|
"name": "n8n-media"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "combine",
|
|
"fieldsToMatchString": "series_name",
|
|
"joinMode": "keepNonMatches",
|
|
"outputDataFrom": "input2",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
192,
|
|
160
|
|
],
|
|
"id": "7d6a56a8-dce0-4577-a6ad-0a98fc5bd4de",
|
|
"name": "Merge, Keep new from SMB"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "upsert",
|
|
"schema": {
|
|
"__rl": true,
|
|
"mode": "list",
|
|
"value": "public"
|
|
},
|
|
"table": {
|
|
"__rl": true,
|
|
"value": "followed_series",
|
|
"mode": "list",
|
|
"cachedResultName": "followed_series"
|
|
},
|
|
"columns": {
|
|
"mappingMode": "defineBelow",
|
|
"value": {
|
|
"active": true,
|
|
"id": "={{ $json.id }}",
|
|
"series_name": "={{ $json.series_name }}",
|
|
"author": "={{ $json.author_folder }}",
|
|
"category": "={{ $json.category }}",
|
|
"smb_path": "={{ $json.smb_path }}",
|
|
"created_at": "={{ $now }}",
|
|
"updated_at": "={{ $now }}",
|
|
"mam_series_id": "={{ $json.mam_series_id }}",
|
|
"enrichment_status": "enriched"
|
|
},
|
|
"matchingColumns": [
|
|
"id"
|
|
],
|
|
"schema": [
|
|
{
|
|
"id": "id",
|
|
"displayName": "id",
|
|
"required": false,
|
|
"defaultMatch": true,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": true,
|
|
"removed": false
|
|
},
|
|
{
|
|
"id": "series_name",
|
|
"displayName": "series_name",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "author",
|
|
"displayName": "author",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "category",
|
|
"displayName": "category",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "smb_path",
|
|
"displayName": "smb_path",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "active",
|
|
"displayName": "active",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "boolean",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "created_at",
|
|
"displayName": "created_at",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "updated_at",
|
|
"displayName": "updated_at",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "dateTime",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "mam_series_id",
|
|
"displayName": "mam_series_id",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": false
|
|
},
|
|
{
|
|
"id": "enrichment_status",
|
|
"displayName": "enrichment_status",
|
|
"required": false,
|
|
"defaultMatch": false,
|
|
"display": true,
|
|
"type": "string",
|
|
"canBeUsedToMatch": false
|
|
}
|
|
],
|
|
"attemptToConvertTypes": false,
|
|
"convertFieldsToString": false
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
1760,
|
|
32
|
|
],
|
|
"id": "a6f4d977-bc0e-4254-829b-b53d65eecdee",
|
|
"name": "Insert or update rows in a table",
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "9grzZwW7Br6SzdV8",
|
|
"name": "n8n-media"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "select",
|
|
"schema": {
|
|
"__rl": true,
|
|
"mode": "list",
|
|
"value": "public"
|
|
},
|
|
"table": {
|
|
"__rl": true,
|
|
"value": "smb_general_books",
|
|
"mode": "list",
|
|
"cachedResultName": "smb_general_books"
|
|
},
|
|
"limit": 1,
|
|
"where": {
|
|
"values": [
|
|
{
|
|
"column": "series_name",
|
|
"value": "={{ $json.series_name }}"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.6,
|
|
"position": [
|
|
864,
|
|
-48
|
|
],
|
|
"id": "6136715e-cbc5-498d-bc68-7cc9be5b4537",
|
|
"name": "Select rows from a table",
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "9grzZwW7Br6SzdV8",
|
|
"name": "n8n-media"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "combine",
|
|
"combineBy": "combineByPosition",
|
|
"options": {
|
|
"clashHandling": {
|
|
"values": {
|
|
"resolveClash": "preferLast"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
1584,
|
|
-32
|
|
],
|
|
"id": "e2dbcac5-5005-4e21-ac16-3dba2b5605ac",
|
|
"name": "Merge"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 3
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "eea3e003-b227-4022-a33f-608d2602103b",
|
|
"leftValue": "={{ $json.series_name }}",
|
|
"rightValue": "The Lord of the Rings",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "notEquals"
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.filter",
|
|
"typeVersion": 2.3,
|
|
"position": [
|
|
416,
|
|
160
|
|
],
|
|
"id": "a8c0fc3e-fa7b-42e0-ac99-b5de3d3b225f",
|
|
"name": "Filter"
|
|
}
|
|
],
|
|
"connections": {
|
|
"Daily at 3 AM": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "select unique series",
|
|
"type": "main",
|
|
"index": 0
|
|
},
|
|
{
|
|
"node": "select followed series",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Enrichment Successful?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Call MAM Series Enricher": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Enrichment Successful?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Loop Over Items": {
|
|
"main": [
|
|
[],
|
|
[
|
|
{
|
|
"node": "Select rows from a table",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"select followed series": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge, Keep new from SMB",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"select unique series": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge, Keep new from SMB",
|
|
"type": "main",
|
|
"index": 1
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Merge, Keep new from SMB": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Filter",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Select rows from a table": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Call MAM Series Enricher",
|
|
"type": "main",
|
|
"index": 0
|
|
},
|
|
{
|
|
"node": "Merge",
|
|
"type": "main",
|
|
"index": 1
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Merge": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Insert or update rows in a table",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Insert or update rows in a table": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Filter": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Loop Over Items",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v0",
|
|
"callerPolicy": "workflowsFromSameOwner",
|
|
"availableInMCP": false
|
|
},
|
|
"triggerCount": 1,
|
|
"versionId": "ad7526e8-17ed-420c-8deb-d7b4db5ba4bb",
|
|
"owner": {
|
|
"type": "personal",
|
|
"projectId": "FeLO36wNUAcn61Wj",
|
|
"projectName": "Ben W <admin@ben.io>",
|
|
"personalEmail": "admin@ben.io"
|
|
},
|
|
"parentFolderId": "6tDyZCwqELStb6Ik",
|
|
"isArchived": false
|
|
} |