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            d.name as document_name,\n            COALESCE(db.id, di.id) as \"document_version_id!\",\n            d.\"branchedFromId\" as \"branched_from_id?\",\n            d.\"branchedFromVersionId\" as \"branched_from_version_id?\",\n            d.\"documentFamilyId\" as \"document_family_id?\",\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            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        FROM\n            \"Document\" d\n        LEFT JOIN document_sub_type dt ON dt.document_id = d.id\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                i.id,\n                i.\"documentId\",\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.\"updatedAt\" DESC\n            LIMIT 1\n        ) di ON d.\"fileType\" IS DISTINCT FROM 'docx'\n        LEFT JOIN \"Project\" p ON p.id = d.\"projectId\"\n        WHERE\n        d.\"deletedAt\" IS NULL\n        ORDER BY d.\"createdAt\" DESC\n        LIMIT $1 OFFSET $2\n\n    ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "document_id",
        "type_info": "Text"
      },
      {
        "ordinal": 1,
        "name": "owner",
        "type_info": "Text"
      },
      {
        "ordinal": 2,
        "name": "document_name",
        "type_info": "Text"
      },
      {
        "ordinal": 3,
        "name": "document_version_id!",
        "type_info": "Int8"
      },
      {
        "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": "file_type",
        "type_info": "Text"
      },
      {
        "ordinal": 8,
        "name": "created_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 9,
        "name": "updated_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 10,
        "name": "deleted_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 11,
        "name": "document_bom?",
        "type_info": "Json"
      },
      {
        "ordinal": 12,
        "name": "modification_data?",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 13,
        "name": "project_id?",
        "type_info": "Text"
      },
      {
        "ordinal": 14,
        "name": "project_name?",
        "type_info": "Text"
      },
      {
        "ordinal": 15,
        "name": "sha?",
        "type_info": "Text"
      },
      {
        "ordinal": 16,
        "name": "sub_type?: DocumentSubType",
        "type_info": {
          "Custom": {
            "name": "document_sub_type_value",
            "kind": {
              "Enum": [
                "task",
                "snippet",
                "skill",
                "initiative_description"
              ]
            }
          }
        }
      }
    ],
    "parameters": {
      "Left": [
        "Int8",
        "Int8"
      ]
    },
    "nullable": [
      false,
      false,
      false,
      null,
      true,
      true,
      true,
      true,
      null,
      null,
      null,
      null,
      null,
      true,
      false,
      false,
      false
    ]
  },
  "hash": "fcd4b67db8a3a8de51b0bb55880c5934f900adbadcc5549165e709cb1cd345b5"
}