{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pipeshub/json-schema/pipeshub-in-app-notification-schema.json",
  "title": "InAppNotification",
  "description": "A user notification record persisted by `NotificationConsumer` in MongoDB\n(`notification.schema.ts`). The document is scoped to a single user via\n`assignedTo` and expires automatically after 30 days (TTL index).\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pipeshub-notifications-api-openapi.yml#/components/schemas/InAppNotification",
  "type": "object",
  "required": [
    "_id",
    "orgId",
    "type",
    "status",
    "assignedTo",
    "isDeleted",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "_id": {
      "type": "string",
      "format": "objectId",
      "description": "MongoDB ObjectId of the notification document"
    },
    "orgId": {
      "type": "string",
      "format": "objectId",
      "description": "Organisation the notification belongs to"
    },
    "type": {
      "type": "string",
      "description": "Notification type discriminator. Connector-originated values include\n`CONNECTOR_AUTH_ERROR`, `CONNECTOR_SYNC_ERROR`, `CONNECTOR_WARNING`,\n`CONNECTOR_INFO`, `CONNECTOR_SUCCESS`, etc.\n"
    },
    "title": {
      "type": "string",
      "description": "Short human-readable heading"
    },
    "message": {
      "type": "string",
      "description": "Full notification body text"
    },
    "severity": {
      "type": "string",
      "enum": [
        "info",
        "warning",
        "error",
        "critical",
        "success"
      ],
      "description": "Visual severity level"
    },
    "status": {
      "type": "string",
      "enum": [
        "read",
        "unread",
        "archived"
      ],
      "default": "unread",
      "description": "Read/unread state of the notification for this user"
    },
    "originService": {
      "type": "string",
      "enum": [
        "Connector Service",
        "Indexing Service",
        "AI Service",
        "External Service"
      ],
      "description": "Service that generated the notification"
    },
    "assignedTo": {
      "type": "string",
      "format": "objectId",
      "description": "MongoDB ObjectId of the user this notification is assigned to"
    },
    "redirectLink": {
      "type": "string",
      "description": "Optional deep-link URL the user should be sent to when clicking the notification"
    },
    "payload": {
      "type": "object",
      "additionalProperties": true,
      "description": "Arbitrary structured data attached by the originating service.\nConnector notifications typically include `connectorId`, `connectorName`,\nand `errorCode` keys.\n"
    },
    "isDeleted": {
      "type": "boolean",
      "default": false,
      "description": "Soft-delete flag; deleted notifications are excluded from all list queries"
    },
    "deletedBy": {
      "type": "string",
      "format": "objectId",
      "description": "ObjectId of the user who dismissed the notification (set on soft-delete)"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp — documents are TTL-expired 30 days after this value"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}