This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/models/models_notification.go
Jeffrey Smith 31548ce801 chore: strip remaining pre-fork version references
Second pass — removes chat-switchboard version numbers from config
field docs, section headers, file headers, and test comments. These
were pre-fork version tags that don't apply to switchboard-core.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 12:22:27 +00:00

47 lines
2.0 KiB
Go

package models
import "time"
// =========================================
// NOTIFICATIONS
// =========================================
// Notification represents an in-app notification for a user.
// Notifications are immutable once created — only is_read can be toggled.
type Notification struct {
ID string `json:"id" db:"id"`
UserID string `json:"user_id" db:"user_id"`
Type string `json:"type" db:"type"` // domain.action, e.g. "role.fallback", "kb.ready"
Title string `json:"title" db:"title"` // short summary shown in bell dropdown
Body string `json:"body,omitempty" db:"body"` // optional detail text
ResourceType string `json:"resource_type,omitempty" db:"resource_type"` // "channel", "knowledge_base", "project", etc.
ResourceID string `json:"resource_id,omitempty" db:"resource_id"` // navigable entity ID (no FK — resource may be deleted)
IsRead bool `json:"is_read" db:"is_read"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
// Notification type constants. Convention: domain.action.
// Free-form strings — new types don't require migration.
const (
NotifTypeRoleFallback = "role.fallback"
NotifTypeKBReady = "kb.ready"
NotifTypeKBError = "kb.error"
NotifTypeGrantChanged = "grant.changed"
NotifTypeUserMentioned = "user.mentioned"
NotifTypeWorkflowAssign = "workflow.assigned"
NotifTypeWorkflowClaimed = "workflow.claimed"
NotifTypeTaskCompleted = "task.completed"
NotifTypeTaskFailed = "task.failed"
NotifTypeTaskBudget = "task.budget_exceeded"
NotifTypeAnnouncement = "system.announcement"
)
// Resource type constants for click-to-navigate.
// Note: ResourceTypeKnowledgeBase is already declared in models.go (resource_grants).
const (
ResourceTypeChannel = "channel"
ResourceTypeProject = "project"
ResourceTypeTeam = "team"
ResourceTypeGroup = "group"
)