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.

4.1 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n        INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)\n        SELECT\n            source.id,\n            source.entity_id,\n            source.entity_type,\n            $4,\n            jsonb_build_object('type', 'SelectOption', 'value', jsonb_build_array($5::text))\n        FROM UNNEST($1::uuid[], $2::text[], $3::property_entity_type[])\n            AS source(id, entity_id, entity_type)\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            NULL 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": "Text"
      },
      {
        "ordinal": 6,
        "name": "created_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 7,
        "name": "updated_at",
        "type_info": "Timestamptz"
      }
    ],
    "parameters": {
      "Left": [
        "UuidArray",
        "TextArray",
        {
          "Custom": {
            "name": "property_entity_type[]",
            "kind": {
              "Array": {
                "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": "9c7cf0202d59d6a1d07ba2254b99d316468775a153e273437ef05bbae2c6f346"
}