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.

2.0 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n        SELECT access_level FROM (\n            -- Source 1: entity_access source_id match\n            SELECT\n                access_level::text FROM entity_access\n            WHERE entity_id = $1\n            AND entity_type = 'email_thread'\n            AND source_id = ANY($2)\n\n            UNION ALL\n            -- Source 2: item share permission\n            SELECT\n                sp.\"linkShareAccessLevel\"::text AS access_level\n            FROM \"SharePermission\" sp\n            WHERE sp.\"linkShareAccessLevel\" IS NOT NULL\n            AND (\n                sp.\"linkShare\" = 'PUBLIC'\n                OR (\n                    sp.\"linkShare\" = 'TEAM'\n                    AND EXISTS (\n                        SELECT 1\n                        FROM email_threads t\n                        JOIN email_links l ON l.id = t.link_id\n                        JOIN team_user owner_tu ON owner_tu.user_id = l.macro_id\n                        WHERE t.id = $1::uuid\n                          AND owner_tu.team_id::text = ANY($2)\n                    )\n                )\n            )\n            AND sp.id IN (\n                SELECT \"sharePermissionId\" FROM \"EmailThreadPermission\" WHERE \"threadId\" = $3\n            )\n\n            UNION ALL\n            -- Source 3: access to the thread's containing project grants View\n            SELECT 'view' AS access_level\n            FROM email_threads t\n            JOIN entity_access pea ON pea.entity_id::text = t.project_id\n                AND pea.entity_type = 'project'\n                AND pea.source_id = ANY($2)\n            WHERE t.id = $1::uuid\n        ) AS combined_access\n        ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "access_level",
        "type_info": "Text"
      }
    ],
    "parameters": {
      "Left": [
        "Uuid",
        "TextArray",
        "Text"
      ]
    },
    "nullable": [
      null
    ]
  },
  "hash": "9646eff91dc45b60761e4a188aa12e8d2845bf7c4d0ee906ef64a16e12bd2852"
}