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_pref.go
2026-03-01 12:40:15 +00:00

21 lines
778 B
Go

package models
// NotificationPreference stores a user's per-type notification delivery preference.
// Type "*" acts as a catch-all default for types without an explicit row.
type NotificationPreference struct {
ID string `json:"id" db:"id"`
UserID string `json:"user_id" db:"user_id"`
Type string `json:"type" db:"type"` // notification type or "*"
InApp bool `json:"in_app" db:"in_app"` // show in-app bell/panel
Email bool `json:"email" db:"email"` // send email
}
// ResolvedPreference is the effective preference after resolution chain.
type ResolvedPreference struct {
InApp bool
Email bool
}
// SystemDefaultPreference is the fallback when no user preference exists.
var SystemDefaultPreference = ResolvedPreference{InApp: true, Email: false}