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.4 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n            WITH updated AS (\n                UPDATE user_notification\n                SET state = CASE WHEN state = 'unseen' THEN 'seen'::notification_state ELSE state END,\n                    seen_at = COALESCE(seen_at, NOW())\n                WHERE user_id = $1 AND notification_id = ANY($2) AND deleted_at IS NULL\n                RETURNING\n                    user_id,\n                    notification_id,\n                    sent,\n                    state,\n                    created_at,\n                    seen_at,\n                    deleted_at\n            )\n            SELECT\n                updated.user_id as owner_id,\n                updated.notification_id,\n                n.event_item_id,\n                n.event_item_type,\n                updated.sent,\n                updated.state as \"state!: NotificationState\",\n                updated.created_at::timestamptz as \"created_at!\",\n                updated.seen_at::timestamptz as viewed_at,\n                NOW()::timestamptz as \"updated_at!\",\n                updated.deleted_at::timestamptz,\n                n.metadata as \"notification_metadata: serde_json::Value\",\n                n.notification_event_type,\n                n.sender_id\n            FROM updated\n            JOIN notification n ON n.id = updated.notification_id\n            ORDER BY array_position($2, updated.notification_id)\n            ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "owner_id",
        "type_info": "Text"
      },
      {
        "ordinal": 1,
        "name": "notification_id",
        "type_info": "Uuid"
      },
      {
        "ordinal": 2,
        "name": "event_item_id",
        "type_info": "Text"
      },
      {
        "ordinal": 3,
        "name": "event_item_type",
        "type_info": "Text"
      },
      {
        "ordinal": 4,
        "name": "sent",
        "type_info": "Bool"
      },
      {
        "ordinal": 5,
        "name": "state!: NotificationState",
        "type_info": {
          "Custom": {
            "name": "notification_state",
            "kind": {
              "Enum": [
                "unseen",
                "seen",
                "done"
              ]
            }
          }
        }
      },
      {
        "ordinal": 6,
        "name": "created_at!",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 7,
        "name": "viewed_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 8,
        "name": "updated_at!",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 9,
        "name": "deleted_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 10,
        "name": "notification_metadata: serde_json::Value",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 11,
        "name": "notification_event_type",
        "type_info": "Varchar"
      },
      {
        "ordinal": 12,
        "name": "sender_id",
        "type_info": "Text"
      }
    ],
    "parameters": {
      "Left": [
        "Text",
        "UuidArray"
      ]
    },
    "nullable": [
      false,
      false,
      false,
      false,
      false,
      false,
      null,
      null,
      null,
      null,
      false,
      false,
      true
    ]
  },
  "hash": "2cb9f1775cb5ba41fbdea48d3a38134e90ce7df7c0ea9a6bf14cb0c4965dd245"
}