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 e4b7ee98a5 step 5 (partial): strip dropped packages from production code
Removed all references to dropped packages in non-test code.
Zero dropped imports, store refs, or model types remaining.

Major removals:
  - scheduler/ package (entire dir) — tasks moved to extension track
  - taskutil/ package (entire dir)
  - health/ package (entire dir) — provider/tool health
  - sandbox/provider_module.go — provider.complete module
  - handlers: workflow_entry, workflow_instances, workflow_forms,
    workflow_assignments, workflow_monitor, health_admin (6 files)
  - auth/session.go, middleware/session_auth.go
  - store/{postgres,sqlite}/sessions.go, tasks.go

Rewrites:
  - store/{postgres,sqlite}/health.go — kernel-only Prune
    (ws_tickets, rate_limit_counters, stale presence)
  - handlers/admin.go: 847→467 lines (stripped provider CRUD)
  - handlers/teams.go: 520→411 lines (stripped model listing)
  - sandbox/runner.go: removed ProviderResolver
  - sandbox/workflow_module.go: 216→83 lines (definition-only)
  - main.go: 1579→1325 lines (stripped dropped package init)
  - pages/pages.go: stripped channel/session lookups
  - events/types.go: stripped chat/channel/workspace event routes
  - models: stripped stale types, constants, notification types

Store interface cleanup:
  - Removed SessionStore, TaskStore from Stores struct
  - Stripped workflow assignment methods from WorkflowStore iface
  - Stripped assignment methods from PG+SQLite workflow stores
  - Updated testhelper.go table list to kernel-only

Migrations: removed 008_tasks.sql (both dialects)

-9665/+69 lines across 51 files.
2026-03-26 04:56:07 -04:00

47 lines
2.0 KiB
Go

package models
import "time"
// =========================================
// NOTIFICATIONS (v0.20.0)
// =========================================
// 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"
)