package models import "time" type User struct { ID int64 `json:"id"` Username string `json:"username"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` // NtfyTopic is where this user's push notifications go. Nil means they get // none of their own; incidents assigned to them fall back to the configured // fallback topic instead. NtfyTopic *string `json:"ntfy_topic,omitempty"` // DisabledAt is when the account was taken out of use, or nil. A disabled // user cannot authenticate by either credential, and keeps their name on // every acknowledgement and timeline entry they made. DisabledAt *time.Time `json:"disabled_at,omitempty"` // IsAdmin is the system administrator flag: managing users and API keys. // Not omitempty — a client has to be able to tell "false" from "this server // is too old to have the field", and the web UI decides what to show from // it. IsAdmin bool `json:"is_admin"` // AdminSource is who granted the flag: "manual" or "oidc". An "oidc" // administrator follows the identity provider's groups, so the UI shows it as // managed there and the API refuses to revoke it by hand. Only set on the // user endpoints that show it. AdminSource string `json:"admin_source,omitempty"` } type APIKey struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` LastUsedAt *time.Time `json:"last_used_at,omitempty"` Key string `json:"key,omitempty"` // populated only on creation, never stored }