- ReadBooks.tsx: remove line-clamp-3, readMore button, and review modal - Show full review text inline instead of truncated snippets - Remove unused AnimatePresence, X import, selectedReview state - Fix typo in 6 handler nodes - Fix Markdown/HTML mix (*text*</b> → <b>text</b>) - Fix Switch condition syntax (.action → .action) - Fix position collision (Review Info Handler) - Hardcode Telegram bot token, fix response handling in Publish Handler - Add AI-generated questions for .review flow (was .review HC_ID TEXT) - New .answer command for submitting review answers - Create/Refine Review: POST new translations if missing instead of skipping - Remove all substring truncations from Telegram messages
219 lines
6.1 KiB
JSON
219 lines
6.1 KiB
JSON
{
|
|
"name": "finishedBooks",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"triggerAtHour": 6
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.3,
|
|
"position": [
|
|
0,
|
|
-64
|
|
],
|
|
"id": "7170586a-8b80-4614-b186-1b661276fd30",
|
|
"name": "Schedule Trigger"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "getAll",
|
|
"collection": "book_reviews",
|
|
"itemFields": [
|
|
"hardcover_id"
|
|
]
|
|
},
|
|
"type": "@directus/n8n-nodes-directus.directus",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
224,
|
|
-64
|
|
],
|
|
"id": "145cc646-45d1-4ce7-9f04-77debe503ec6",
|
|
"name": "Get_Existing_Books",
|
|
"credentials": {
|
|
"directusApi": {
|
|
"id": "QnVxKFcSXqpaG86u",
|
|
"name": "Directus"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://api.hardcover.app/v1/graphql",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBearerAuth",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "content-type",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"bodyParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "query GetReadBooks { me { user_books(where: {status_id: {_eq: 3}}, limit: 10, order_by: {last_read_date: desc}) { last_read_date rating edition { title image { url } book { id contributions { author { name } } } } } } }"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.3,
|
|
"position": [
|
|
448,
|
|
-64
|
|
],
|
|
"id": "c2e0f7e4-a30e-4083-b4a9-a1a7e9f8ba3f",
|
|
"name": "hardcover",
|
|
"credentials": {
|
|
"httpBearerAuth": {
|
|
"id": "Kmf2fBCFkuRuWWZa",
|
|
"name": "Hardcover"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// 1. Alle gelesenen Bücher von Hardcover holen\nconst hcData = $input.all()[0]?.json;\nconst hcBooks = hcData?.data?.me?.[0]?.user_books || [];\n// 2. Alle bereits in Directus existierenden IDs holen\nlet existingIds = [];\ntry{\n const existingItems = $('Get_Existing_Books').all();\n existingIds = existingItems.map(item => item.json.hardcover_id?.toString());\n } catch (e) {\n // Falls noch gar keine Bücher in Directus sind, ist die Liste einfach leer\n existingIds = [];\n}\n// 3. Filtern: Nur Bücher behalten, deren ID noch NICHT in Directus ist\nconst newBooks = hcBooks.filter(entry => {\n const id = entry.edition.book.id.toString();\n return !existingIds.includes(id);\n});\n// 4. Die neuen Bücher für Directus formatieren\nreturn newBooks.map(entry => {\n const ed = entry.edition || {};\n return {\n json: {\n book_title: ed.title,\n book_author: ed.book?.contributions?.[0]?.author?.name || \"Unbekannter Autor\",\n book_image: ed.image?.url || null,\n hardcover_id: ed.book?.id?.toString(),\n finished_at: entry.last_read_date,\n rating: entry.rating || null,\n status: \"draft\"\n }\n };\n});"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
672,
|
|
-64
|
|
],
|
|
"id": "a0bc4f01-264f-46c3-a667-359983109a72",
|
|
"name": "removeDuplicates"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"collection": "book_reviews",
|
|
"collectionFields": {
|
|
"fields": {
|
|
"field": [
|
|
{
|
|
"name": "status",
|
|
"value": "={{ $json.status }}"
|
|
},
|
|
{
|
|
"name": "book_title",
|
|
"value": "={{ $json.book_title }}"
|
|
},
|
|
{
|
|
"name": "book_author",
|
|
"value": "={{ $json.book_author }}"
|
|
},
|
|
{
|
|
"name": "rating",
|
|
"value": "={{ $json.rating }}"
|
|
},
|
|
{
|
|
"name": "book_image",
|
|
"value": "={{ $json.book_image }}"
|
|
},
|
|
{
|
|
"name": "hardcover_id",
|
|
"value": "={{ $json.hardcover_id }}"
|
|
},
|
|
{
|
|
"name": "finished_at",
|
|
"value": "={{ $json.finished_at }}"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"type": "@directus/n8n-nodes-directus.directus",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
896,
|
|
-64
|
|
],
|
|
"id": "0f3db869-1832-4041-8d1d-2a3d834922f0",
|
|
"name": "Create an item",
|
|
"credentials": {
|
|
"directusApi": {
|
|
"id": "QnVxKFcSXqpaG86u",
|
|
"name": "Directus"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"pinData": {},
|
|
"connections": {
|
|
"Schedule Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Get_Existing_Books",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Get_Existing_Books": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "hardcover",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"hardcover": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "removeDuplicates",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"removeDuplicates": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Create an item",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"active": true,
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"availableInMCP": false
|
|
},
|
|
"versionId": "2fa60722-a717-44da-9047-c867a440609c",
|
|
"meta": {
|
|
"templateCredsSetupCompleted": true,
|
|
"instanceId": "cb28e4db755465d5826da179e87f69603d81f833414cc52c327be9183a217b8d"
|
|
},
|
|
"id": "sbpapdCb7OBoRdc_3j0VL",
|
|
"tags": []
|
|
} |