From c8ce15385a61eccc16583b6b46253f302eaa8831 Mon Sep 17 00:00:00 2001 From: Kenichiro NOGI Date: Sat, 5 Sep 2026 18:17:37 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20HC-WP=E3=81=AE=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E5=80=A4=E5=8F=96=E5=BE=97=E3=82=92filter=E4=BB=98=E3=81=8DGet?= =?UTF-8?q?=E3=81=8B=E3=82=89=E4=B8=80=E6=8B=AC=E5=8F=96=E5=BE=97+Code?= =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit n8nワークフロー構築の基本ルール(Data Table利用最小限)に合わせ、 HEALTHCHECK_WP_API_KEYの取得方法をfilters付き単一キーGetから returnAll:trueの一括取得+Codeノード内find()に変更。ノード数は 5のまま変わらず。 Co-Authored-By: Claude Sonnet 5 --- .../workflows/hc-wp-status-push.json | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/NodeSrv/apps/healthcheck-survey-bot/workflows/hc-wp-status-push.json b/NodeSrv/apps/healthcheck-survey-bot/workflows/hc-wp-status-push.json index da46c23d..cc37724b 100644 --- a/NodeSrv/apps/healthcheck-survey-bot/workflows/hc-wp-status-push.json +++ b/NodeSrv/apps/healthcheck-survey-bot/workflows/hc-wp-status-push.json @@ -20,7 +20,7 @@ }, { "id": "dt-get-healthcheck_wp_api_key", - "name": "HEALTHCHECK_WP_API_KEY取得", + "name": "設定値一括取得", "type": "n8n-nodes-base.dataTable", "typeVersion": 1, "position": [ @@ -34,14 +34,6 @@ "mode": "id", "value": "bNkadTyDgDepYx2p" }, - "filters": { - "conditions": [ - { - "keyName": "configKey", - "keyValue": "HEALTHCHECK_WP_API_KEY" - } - ] - }, "returnAll": true } }, @@ -55,7 +47,7 @@ 300 ], "parameters": { - "jsCode": "const expectedApiKey = $('HEALTHCHECK_WP_API_KEY取得').item.json.configValue;\nconst headers = $input.first().json.headers || {};\nif (headers[\"x-api-key\"] !== expectedApiKey) {\n throw new Error(\"Unauthorized: invalid API key\");\n}\nconst body = $input.first().json.body || {};\nif (!body.resultId || !body.processId) {\n throw new Error(\"Bad Request: resultId, processId は必須です\");\n}\nreturn [{ json: { resultId: body.resultId, processId: body.processId } }];" + "jsCode": "const configRows = $('設定値一括取得').all().map((item) => item.json);\nconst expectedApiKey = configRows.find((row) => row.configKey === \"HEALTHCHECK_WP_API_KEY\")?.configValue;\nconst headers = $input.first().json.headers || {};\nif (headers[\"x-api-key\"] !== expectedApiKey) {\n throw new Error(\"Unauthorized: invalid API key\");\n}\nconst body = $input.first().json.body || {};\nif (!body.resultId || !body.processId) {\n throw new Error(\"Bad Request: resultId, processId は必須です\");\n}\nreturn [{ json: { resultId: body.resultId, processId: body.processId } }];" } }, { @@ -103,14 +95,14 @@ "main": [ [ { - "node": "HEALTHCHECK_WP_API_KEY取得", + "node": "設定値一括取得", "type": "main", "index": 0 } ] ] }, - "HEALTHCHECK_WP_API_KEY取得": { + "設定値一括取得": { "main": [ [ {