Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
{
"db_name": "PostgreSQL",
"query": "\n WITH user_source_ids AS (\n SELECT cp.channel_id::text as source_id FROM comms_channel_participants cp\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n UNION ALL\n SELECT t.team_id::text FROM team_user t\n WHERE t.user_id = $1\n UNION ALL\n SELECT $1\n ),\n UserAccessibleDocuments AS (\n SELECT DISTINCT ON (entity_id) entity_id, access_level\n FROM entity_access\n WHERE source_id = ANY(SELECT source_id FROM user_source_ids)\n AND entity_type = 'document'\n ORDER BY entity_id,\n CASE access_level::text\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3\n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END DESC\n )\n SELECT\n d.id as \"document_id!\",\n d.name as \"document_name!\",\n d.owner as \"owner!\",\n d.\"fileType\" as \"file_type\",\n d.\"projectId\" as \"project_id\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\",\n d.\"deletedAt\"::timestamptz as \"deleted_at\",\n uad.access_level::text as \"access_level!\"\n FROM \"Document\" d\n INNER JOIN UserAccessibleDocuments uad ON uad.entity_id = d.id::uuid\n WHERE d.\"deletedAt\" IS NULL\n AND ($2::text[] IS NULL OR d.\"fileType\" = ANY($2))\n AND (\n CASE uad.access_level::text\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3\n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END >=\n CASE $3\n WHEN 'owner' THEN 4\n WHEN 'edit' THEN 3\n WHEN 'comment' THEN 2\n WHEN 'view' THEN 1\n ELSE 0\n END\n )\n ORDER BY d.\"updatedAt\" DESC\n LIMIT $4 OFFSET $5\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "document_id!",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "document_name!",
"type_info": "Text"
},
{
"ordinal": 2,
"name": "owner!",
"type_info": "Text"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Text"
},
{
"ordinal": 4,
"name": "project_id",
"type_info": "Text"
},
{
"ordinal": 5,
"name": "created_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 6,
"name": "updated_at!",
"type_info": "Timestamptz"
},
{
"ordinal": 7,
"name": "deleted_at",
"type_info": "Timestamptz"
},
{
"ordinal": 8,
"name": "access_level!",
"type_info": "Text"
}
],
"parameters": {
"Left": [
"Text",
"TextArray",
"Text",
"Int8",
"Int8"
]
},
"nullable": [
false,
false,
false,
true,
true,
null,
null,
null,
null
]
},
"hash": "47527ceedb84aa81cf48fd3529718a5303e9f456e3db0ac35840627b086d3995"
}