{
  "updatedAt": "2026-04-22T12:43:23.749Z",
  "createdAt": "2026-04-14T21:25:18.474Z",
  "id": "QnMwTwAcxUeKPTUq",
  "name": "list_ideas",
  "description": null,
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "user_id"
            },
            {
              "name": "project_id"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "id": "acbf7aa5-3f8b-4822-9d5f-c32d1d18f64e",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT\n  id,\n  title,\n  description,\n  keywords,\n  status,\n  created_at,\n  updated_at\nFROM ideas\nWHERE user_id = '{{$('Set').item.json.user_id}}'::UUID\n  {{ ($('Set').item.json.project_id && $('Set').item.json.project_id !== '0') ? \"AND project_id = '\" + $('Set').item.json.project_id + \"'::UUID\" : \"\" }}\nORDER BY\n  CASE status\n    WHEN 'active' THEN 0\n    WHEN 'paused' THEN 1\n    WHEN 'done' THEN 2\n    WHEN 'dropped' THEN 3\n    ELSE 4\n  END,\n  updated_at DESC;",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        416,
        0
      ],
      "id": "9f08b759-b105-4f1f-a9f7-685843abb7f7",
      "name": "Execute a SQL query",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "74479bfc-303e-46fa-b85b-97d35ed23e81",
              "name": "user_id",
              "value": "={{$json.user_id}}",
              "type": "string"
            },
            {
              "id": "5b1bef2a-8972-4cbb-b802-93e012ccb9ce",
              "name": "project_id",
              "value": "={{$json.project_id || \"\"}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "9fda75b5-6f00-4099-a964-18262bcb877c",
      "name": "Set"
    },
    {
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      success: true,\n      ideas: items.map((item) => ({\n        id: item.json.id,\n        title: item.json.title,\n        description: item.json.description,\n        keywords: item.json.keywords,\n        status: item.json.status,\n        created_at: item.json.created_at,\n        updated_at: item.json.updated_at,\n      })),\n    },\n  },\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        624,
        0
      ],
      "id": "e55ae24d-0f0d-4fb3-b8fd-96ffb9c1d875",
      "name": "Code in JavaScript"
    }
  ],
  "connections": {
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Execute a SQL query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute a SQL query": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "e5e06144-f54c-4082-a427-c70217091f2e",
  "activeVersionId": "e5e06144-f54c-4082-a427-c70217091f2e",
  "versionCounter": 38,
  "triggerCount": 0,
  "tags": [],
  "shared": [
    {
      "updatedAt": "2026-04-14T21:25:18.474Z",
      "createdAt": "2026-04-14T21:25:18.474Z",
      "role": "workflow:owner",
      "workflowId": "QnMwTwAcxUeKPTUq",
      "projectId": "LQlSPgCOpK5UqmRi",
      "project": {
        "updatedAt": "2026-04-13T14:09:18.447Z",
        "createdAt": "2026-04-13T13:31:51.826Z",
        "id": "LQlSPgCOpK5UqmRi",
        "name": "Research Agent <rodionsurin@outlook.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "creatorId": "6522aeb4-c3cd-45eb-a107-c97cbbb614b8"
      }
    }
  ],
  "versionMetadata": {
    "name": "Version e5e06144",
    "description": ""
  }
}