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.1 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n        SELECT\n            d.id as \"document_id\",\n            d.owner as \"owner\",\n            COALESCE(db.id, di.id) as \"document_version_id!\",\n            d.name as \"document_name\",\n            d.\"branchedFromId\" as \"branched_from_id\",\n            d.\"branchedFromVersionId\" as \"branched_from_version_id\",\n            d.\"documentFamilyId\" as \"document_family_id\",\n            d.\"createdAt\"::timestamptz as \"created_at\",\n            d.\"updatedAt\"::timestamptz as \"updated_at\",\n            d.\"fileType\" as \"file_type\",\n            db.bom_parts as \"document_bom?\",\n            di.modification_data as \"modification_data?\",\n            d.\"projectId\" as \"project_id\",\n            p.name as \"project_name?\",\n            di.sha as \"sha?\",\n            dt.sub_type as \"sub_type?: DocumentSubType\",\n            d.\"deletedAt\"::timestamptz as \"deleted_at\"\n        FROM\n            \"Document\" d\n        LEFT JOIN document_sub_type dt ON dt.document_id = d.id\n        LEFT JOIN LATERAL (\n            SELECT\n                i.id,\n                i.sha,\n                i.\"createdAt\",\n                (\n                    SELECT\n                        imod.\"modificationData\"\n                    FROM\n                        \"DocumentInstanceModificationData\" imod\n                    WHERE\n                        imod.\"documentInstanceId\" = i.id\n                ) as modification_data,\n                i.\"updatedAt\"\n            FROM\n                \"DocumentInstance\" i\n            WHERE\n                i.\"documentId\" = d.id\n            ORDER BY\n                i.\"createdAt\" DESC\n            LIMIT 1\n        ) di ON true\n        LEFT JOIN LATERAL (\n            SELECT\n                b.id,\n                (\n                    SELECT\n                        json_agg(\n                            json_build_object(\n                                'id', bp.id,\n                                'sha', bp.sha,\n                                'path', bp.path\n                            )\n                        )\n                    FROM\n                        \"BomPart\" bp\n                    WHERE\n                        bp.\"documentBomId\" = b.id\n                ) as bom_parts\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 d.\"fileType\" = 'docx'\n        LEFT JOIN LATERAL (\n            SELECT\n                p.name\n            FROM \"Project\" p\n            WHERE p.id = d.\"projectId\"\n        ) p ON d.\"projectId\" IS NOT NULL\n        WHERE\n            d.id = $1\n        LIMIT 1\n    ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "document_id",
        "type_info": "Text"
      },
      {
        "ordinal": 1,
        "name": "owner",
        "type_info": "Text"
      },
      {
        "ordinal": 2,
        "name": "document_version_id!",
        "type_info": "Int8"
      },
      {
        "ordinal": 3,
        "name": "document_name",
        "type_info": "Text"
      },
      {
        "ordinal": 4,
        "name": "branched_from_id",
        "type_info": "Text"
      },
      {
        "ordinal": 5,
        "name": "branched_from_version_id",
        "type_info": "Int8"
      },
      {
        "ordinal": 6,
        "name": "document_family_id",
        "type_info": "Int8"
      },
      {
        "ordinal": 7,
        "name": "created_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 8,
        "name": "updated_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 9,
        "name": "file_type",
        "type_info": "Text"
      },
      {
        "ordinal": 10,
        "name": "document_bom?",
        "type_info": "Json"
      },
      {
        "ordinal": 11,
        "name": "modification_data?",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 12,
        "name": "project_id",
        "type_info": "Text"
      },
      {
        "ordinal": 13,
        "name": "project_name?",
        "type_info": "Text"
      },
      {
        "ordinal": 14,
        "name": "sha?",
        "type_info": "Text"
      },
      {
        "ordinal": 15,
        "name": "sub_type?: DocumentSubType",
        "type_info": {
          "Custom": {
            "name": "document_sub_type_value",
            "kind": {
              "Enum": [
                "task",
                "snippet",
                "skill",
                "initiative_description"
              ]
            }
          }
        }
      },
      {
        "ordinal": 16,
        "name": "deleted_at",
        "type_info": "Timestamptz"
      }
    ],
    "parameters": {
      "Left": [
        "Text"
      ]
    },
    "nullable": [
      false,
      false,
      null,
      false,
      true,
      true,
      true,
      null,
      null,
      true,
      null,
      null,
      true,
      false,
      false,
      false,
      null
    ]
  },
  "hash": "cc55e105bd5f6916a779d57ed7e4379c7fdaca83a33355842cf8b0b29d25a517"
}