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.

3.8 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n        WITH previous AS (\n            SELECT values FROM entity_properties\n            WHERE entity_id = $2 AND entity_type = $3 AND property_definition_id = $4\n        )\n        INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)\n        VALUES (\n            $1, $2, $3, $4,\n            jsonb_build_object('type', 'SelectOption', 'value', jsonb_build_array($5::text))\n        )\n        ON CONFLICT (entity_id, entity_type, property_definition_id)\n        DO UPDATE SET\n            values = CASE\n                WHEN entity_properties.values ->> 'type' = 'SelectOption'\n                     AND entity_properties.values -> 'value' @> jsonb_build_array($5::text)\n                    THEN entity_properties.values\n                WHEN entity_properties.values ->> 'type' = 'SelectOption'\n                    THEN jsonb_set(\n                            entity_properties.values,\n                            '{value}',\n                            (entity_properties.values -> 'value') || jsonb_build_array($5::text)\n                        )\n                ELSE jsonb_build_object('type', 'SelectOption', 'value', jsonb_build_array($5::text))\n            END,\n            updated_at = NOW()\n        RETURNING\n            id,\n            entity_id,\n            entity_type as \"entity_type: EntityType\",\n            property_definition_id,\n            values as \"value: serde_json::Value\",\n            (SELECT values FROM previous) as \"previous: serde_json::Value\",\n            created_at,\n            updated_at\n        ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "id",
        "type_info": "Uuid"
      },
      {
        "ordinal": 1,
        "name": "entity_id",
        "type_info": "Text"
      },
      {
        "ordinal": 2,
        "name": "entity_type: EntityType",
        "type_info": {
          "Custom": {
            "name": "property_entity_type",
            "kind": {
              "Enum": [
                "CHANNEL",
                "CHAT",
                "DOCUMENT",
                "PROJECT",
                "THREAD",
                "USER",
                "COMPANY",
                "TASK",
                "CALL_RECORD",
                "CALENDAR_EVENT",
                "INITIATIVE",
                "CONTACT",
                "DATABASE_ROW"
              ]
            }
          }
        }
      },
      {
        "ordinal": 3,
        "name": "property_definition_id",
        "type_info": "Uuid"
      },
      {
        "ordinal": 4,
        "name": "value: serde_json::Value",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 5,
        "name": "previous: serde_json::Value",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 6,
        "name": "created_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 7,
        "name": "updated_at",
        "type_info": "Timestamptz"
      }
    ],
    "parameters": {
      "Left": [
        "Uuid",
        "Text",
        {
          "Custom": {
            "name": "property_entity_type",
            "kind": {
              "Enum": [
                "CHANNEL",
                "CHAT",
                "DOCUMENT",
                "PROJECT",
                "THREAD",
                "USER",
                "COMPANY",
                "TASK",
                "CALL_RECORD",
                "CALENDAR_EVENT",
                "INITIATIVE",
                "CONTACT",
                "DATABASE_ROW"
              ]
            }
          }
        },
        "Uuid",
        "Text"
      ]
    },
    "nullable": [
      false,
      false,
      false,
      false,
      true,
      null,
      false,
      false
    ]
  },
  "hash": "6645d947e0e4f0c75e6a34b49690b22130ff90a6af5659837e2202381be03393"
}