Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

5.2 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n        SELECT\n            'document' as \"item_type!\",\n            d.id as \"id!\",\n            CAST(COALESCE(di.id, db.id) as TEXT) as \"document_version_id\",\n            d.owner as \"user_id!\",\n            d.name as \"name!\",\n            d.\"fileType\" as \"file_type\",\n            d.\"createdAt\"::timestamptz as \"created_at\",\n            d.\"updatedAt\"::timestamptz as \"updated_at\",\n            d.\"deletedAt\"::timestamptz as \"deleted_at\",\n            d.\"projectId\" as \"project_id\",\n            NULL as \"is_persistent\",\n            dt.sub_type as \"sub_type?: DocumentSubType\",\n            CASE \n                WHEN dt.sub_type = 'task' \n                    AND ep_status.values->'value' ? $2\n                THEN true \n                WHEN dt.sub_type = 'task'\n                THEN false\n                ELSE NULL \n            END as \"is_completed\"\n        FROM \"Document\" d\n        LEFT JOIN document_sub_type dt ON dt.document_id = d.id\n        LEFT JOIN entity_properties ep_status \n            ON dt.sub_type = 'task'\n            AND ep_status.entity_id = d.id \n            AND ep_status.entity_type = 'TASK'\n            AND ep_status.property_definition_id = $3\n        LEFT JOIN LATERAL (\n            SELECT\n                b.id\n            FROM\n                \"DocumentBom\" b\n            WHERE\n                b.\"documentId\" = d.id\n            ORDER BY\n                b.\"createdAt\" DESC\n            LIMIT 1\n        ) db ON true\n        LEFT JOIN LATERAL (\n            SELECT\n                i.id\n            FROM\n                \"DocumentInstance\" i\n            WHERE\n                i.\"documentId\" = d.id\n            ORDER BY\n                i.\"updatedAt\" DESC\n            LIMIT 1\n        ) di ON true\n        WHERE d.owner = $1 AND d.\"deletedAt\" IS NOT NULL\n        UNION ALL\n        SELECT\n            'chat' as \"item_type!\",\n            c.id as \"id!\",\n            NULL as \"document_version_id\",\n            c.\"userId\" as \"user_id!\",\n            c.name as \"name!\",\n            NULL as \"file_type\",\n            c.\"createdAt\"::timestamptz as \"created_at\",\n            c.\"updatedAt\"::timestamptz as \"updated_at\",\n            c.\"deletedAt\"::timestamptz as \"deleted_at\",\n            c.\"projectId\" as \"project_id\",\n            c.\"isPersistent\" as \"is_persistent\",\n            NULL as \"sub_type\",\n            NULL as \"is_completed\"\n        FROM \"Chat\" c\n        WHERE c.\"userId\" = $1 AND c.\"deletedAt\" IS NOT NULL\n        UNION ALL\n        SELECT\n            'project' as \"item_type!\",\n            p.id as \"id!\",\n            NULL as \"document_version_id\",\n            p.\"userId\" as \"user_id!\",\n            p.name as \"name!\",\n            NULL as \"file_type\",\n            p.\"createdAt\"::timestamptz as \"created_at\",\n            p.\"updatedAt\"::timestamptz as \"updated_at\",\n            p.\"deletedAt\"::timestamptz as \"deleted_at\",\n            p.\"parentId\" as \"project_id\",\n            NULL as \"is_persistent\",\n            NULL as \"sub_type\",\n            NULL as \"is_completed\"\n        FROM \"Project\" p\n        WHERE p.\"userId\" = $1 AND p.\"deletedAt\" IS NOT NULL\n    ORDER BY deleted_at DESC\n    ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "item_type!",
        "type_info": "Text"
      },
      {
        "ordinal": 1,
        "name": "id!",
        "type_info": "Text"
      },
      {
        "ordinal": 2,
        "name": "document_version_id",
        "type_info": "Text"
      },
      {
        "ordinal": 3,
        "name": "user_id!",
        "type_info": "Text"
      },
      {
        "ordinal": 4,
        "name": "name!",
        "type_info": "Text"
      },
      {
        "ordinal": 5,
        "name": "file_type",
        "type_info": "Text"
      },
      {
        "ordinal": 6,
        "name": "created_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 7,
        "name": "updated_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 8,
        "name": "deleted_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 9,
        "name": "project_id",
        "type_info": "Text"
      },
      {
        "ordinal": 10,
        "name": "is_persistent",
        "type_info": "Bool"
      },
      {
        "ordinal": 11,
        "name": "sub_type?: DocumentSubType",
        "type_info": {
          "Custom": {
            "name": "document_sub_type_value",
            "kind": {
              "Enum": [
                "task",
                "snippet",
                "skill",
                "initiative_description"
              ]
            }
          }
        }
      },
      {
        "ordinal": 12,
        "name": "is_completed",
        "type_info": "Bool"
      }
    ],
    "parameters": {
      "Left": [
        "Text",
        "Text",
        "Uuid"
      ]
    },
    "nullable": [
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null
    ]
  },
  "hash": "5959ff0d2410e3f2599a53bc1bf0de19c2d6e90cb030f64dccf965a0515b467e"
}