models

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPageSettingsKey = "status_page"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditAction

type AuditAction string
const (
	AuditActionCreated       AuditAction = "created"
	AuditActionEdited        AuditAction = "edited"
	AuditActionStatusChanged AuditAction = "status_changed"
	AuditActionUpdateAdded   AuditAction = "update_added"
	AuditActionResolved      AuditAction = "resolved"
	AuditActionDeleted       AuditAction = "deleted"
	AuditActionPublished     AuditAction = "published"
	AuditActionDraftSaved    AuditAction = "draft_saved"
)

type AuditLog

type AuditLog struct {
	ID            primitive.ObjectID  `bson:"_id,omitempty" json:"id"`
	ResourceType  AuditResourceType   `bson:"resourceType" json:"resourceType"`
	ResourceID    primitive.ObjectID  `bson:"resourceId" json:"resourceId"`
	Action        AuditAction         `bson:"action" json:"action"`
	ActorID       *primitive.ObjectID `bson:"actorId,omitempty" json:"actorId,omitempty"`
	ActorUsername string              `bson:"actorUsername,omitempty" json:"actorUsername,omitempty"`
	At            time.Time           `bson:"at" json:"at"`
	Summary       string              `bson:"summary,omitempty" json:"summary,omitempty"`
	Changes       map[string]any      `bson:"changes,omitempty" json:"changes,omitempty"`
}

type AuditResourceType

type AuditResourceType string
const (
	AuditResourceIncident       AuditResourceType = "incident"
	AuditResourceIncidentUpdate AuditResourceType = "incident_update"
	AuditResourceMaintenance    AuditResourceType = "maintenance"
)

type Component

type Component struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Name        string             `bson:"name" json:"name"`
	Description string             `bson:"description" json:"description"`
	Status      ComponentStatus    `bson:"status" json:"status"`
	Order       int                `bson:"order"`
	CreatedAt   time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt   time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type ComponentStatus

type ComponentStatus string
const (
	StatusOperational   ComponentStatus = "operational"
	StatusDegradedPerf  ComponentStatus = "degraded_performance"
	StatusPartialOutage ComponentStatus = "partial_outage"
	StatusMajorOutage   ComponentStatus = "major_outage"
	StatusMaintenance   ComponentStatus = "maintenance"
)

type DailyUptime

type DailyUptime struct {
	ID               primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	MonitorID        primitive.ObjectID `bson:"monitorId" json:"monitorId"`
	Date             time.Time          `bson:"date" json:"date"`
	TotalChecks      int                `bson:"totalChecks" json:"totalChecks"`
	SuccessfulChecks int                `bson:"successfulChecks" json:"successfulChecks"`
	UptimePercent    float64            `bson:"uptimePercent" json:"uptimePercent"`
}

type EnhancedMonitorLog

type EnhancedMonitorLog struct {
	ID                       primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	MonitorID                primitive.ObjectID `bson:"monitorId" json:"monitorId"`
	Status                   MonitorLogStatus   `bson:"status" json:"status"`
	SSLWarning               bool               `bson:"sslWarning,omitempty" json:"sslWarning,omitempty"`
	SSLDaysRemaining         int                `bson:"sslDaysRemaining,omitempty" json:"sslDaysRemaining,omitempty"`
	SSLTriggeredThreshold    int                `bson:"sslTriggeredThreshold,omitempty" json:"sslTriggeredThreshold,omitempty"`
	DomainWarning            bool               `bson:"domainWarning,omitempty" json:"domainWarning,omitempty"`
	DomainDaysRemaining      int                `bson:"domainDaysRemaining,omitempty" json:"domainDaysRemaining,omitempty"`
	DomainTriggeredThreshold int                `bson:"domainTriggeredThreshold,omitempty" json:"domainTriggeredThreshold,omitempty"`
	ResponseTime             int64              `bson:"responseTime" json:"responseTime"`
	StatusCode               int                `bson:"statusCode" json:"statusCode"`
	CheckedAt                time.Time          `bson:"checkedAt" json:"checkedAt"`
	StartedAt                time.Time          `bson:"startedAt,omitempty" json:"startedAt,omitempty"`
	EndedAt                  time.Time          `bson:"endedAt,omitempty" json:"endedAt,omitempty"`
	DurationSeconds          int                `bson:"durationSeconds,omitempty" json:"durationSeconds,omitempty"`
}

type Incident

type Incident struct {
	ID                       primitive.ObjectID          `bson:"_id,omitempty" json:"id"`
	Title                    string                      `bson:"title" json:"title"`
	Description              string                      `bson:"description" json:"description"`
	DescriptionJSON          RichTextDocument            `bson:"descriptionJson,omitempty" json:"descriptionJson,omitempty"`
	VisibilityState          IncidentVisibilityState     `bson:"visibilityState,omitempty" json:"visibilityState,omitempty"`
	PostmortemEnabled        bool                        `bson:"postmortemEnabled,omitempty" json:"postmortemEnabled,omitempty"`
	PostmortemContentJSON    RichTextDocument            `bson:"postmortemContentJson,omitempty" json:"postmortemContentJson,omitempty"`
	Status                   IncidentStatus              `bson:"status" json:"status"`
	Impact                   IncidentImpact              `bson:"impact" json:"impact"`
	CreatorID                *primitive.ObjectID         `bson:"creatorId,omitempty" json:"creatorId,omitempty"`
	CreatorUsername          string                      `bson:"creatorUsername,omitempty" json:"creatorUsername,omitempty"`
	AffectedComponents       []primitive.ObjectID        `bson:"affectedComponents" json:"affectedComponents"`
	AffectedComponentTargets []IncidentAffectedComponent `bson:"affectedComponentTargets,omitempty" json:"affectedComponentTargets,omitempty"`
	CreatedAt                time.Time                   `bson:"createdAt" json:"createdAt"`
	UpdatedAt                time.Time                   `bson:"updatedAt" json:"updatedAt"`
	ResolvedAt               *time.Time                  `bson:"resolvedAt,omitempty" json:"resolvedAt,omitempty"`
}

type IncidentAffectedComponent

type IncidentAffectedComponent struct {
	ComponentID     primitive.ObjectID   `bson:"componentId" json:"componentId"`
	SubComponentIDs []primitive.ObjectID `bson:"subComponentIds,omitempty" json:"subComponentIds,omitempty"`
}

type IncidentAffectedComponentExpanded

type IncidentAffectedComponentExpanded struct {
	Component     Component      `json:"component"`
	SubComponents []SubComponent `json:"subComponents,omitempty"`
}

type IncidentImpact

type IncidentImpact string
const (
	ImpactNone     IncidentImpact = "none"
	ImpactMinor    IncidentImpact = "minor"
	ImpactMajor    IncidentImpact = "major"
	ImpactCritical IncidentImpact = "critical"
)

type IncidentStatus

type IncidentStatus string
const (
	IncidentInvestigating IncidentStatus = "investigating"
	IncidentIdentified    IncidentStatus = "identified"
	IncidentMonitoring    IncidentStatus = "monitoring"
	IncidentResolved      IncidentStatus = "resolved"
)

type IncidentUpdate

type IncidentUpdate struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	IncidentID  primitive.ObjectID `bson:"incidentId" json:"incidentId"`
	Message     string             `bson:"message" json:"message"`
	MessageJSON RichTextDocument   `bson:"messageJson,omitempty" json:"messageJson,omitempty"`
	Status      IncidentStatus     `bson:"status" json:"status"`
	CreatedAt   time.Time          `bson:"createdAt" json:"createdAt"`
}

type IncidentVisibilityState

type IncidentVisibilityState string
const (
	IncidentVisibilityDraft     IncidentVisibilityState = "draft"
	IncidentVisibilityPublished IncidentVisibilityState = "published"
)

type IncidentWithUpdates

type IncidentWithUpdates struct {
	Incident
	Updates                  []IncidentUpdate                    `json:"updates"`
	AffectedComponents       []Component                         `json:"affectedComponents"`
	AffectedComponentTargets []IncidentAffectedComponentExpanded `json:"affectedComponentTargets,omitempty"`
}

type Maintenance

type Maintenance struct {
	ID              primitive.ObjectID   `bson:"_id,omitempty" json:"id"`
	Title           string               `bson:"title" json:"title"`
	Description     string               `bson:"description" json:"description"`
	DescriptionJSON RichTextDocument     `bson:"descriptionJson,omitempty" json:"descriptionJson,omitempty"`
	CreatorID       *primitive.ObjectID  `bson:"creatorId,omitempty" json:"creatorId,omitempty"`
	CreatorUsername string               `bson:"creatorUsername,omitempty" json:"creatorUsername,omitempty"`
	Components      []primitive.ObjectID `bson:"components" json:"components"`
	StartTime       time.Time            `bson:"startTime" json:"startTime"`
	EndTime         time.Time            `bson:"endTime" json:"endTime"`
	Status          MaintenanceStatus    `bson:"status" json:"status"`
	UpdatedAt       time.Time            `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"`
}

type MaintenanceStatus

type MaintenanceStatus string
const (
	MaintenanceDraft      MaintenanceStatus = "draft"
	MaintenanceScheduled  MaintenanceStatus = "scheduled"
	MaintenanceInProgress MaintenanceStatus = "in_progress"
	MaintenanceActive     MaintenanceStatus = "active"
	MaintenanceCompleted  MaintenanceStatus = "completed"
)

type Monitor

type Monitor struct {
	ID                       primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Name                     string             `bson:"name" json:"name"`
	Type                     MonitorType        `bson:"type" json:"type"`
	Target                   string             `bson:"target" json:"target"`
	Monitoring               MonitorConfig      `bson:"monitoring,omitempty" json:"monitoring,omitempty"`
	SSLThresholds            []int              `bson:"sslThresholds,omitempty" json:"sslThresholds,omitempty"`
	IntervalSeconds          int                `bson:"intervalSeconds" json:"intervalSeconds"`
	TimeoutSeconds           int                `bson:"timeoutSeconds" json:"timeoutSeconds"`
	ComponentID              primitive.ObjectID `bson:"componentId,omitempty" json:"componentId,omitempty"`
	SubComponentID           primitive.ObjectID `bson:"subComponentId,omitempty" json:"subComponentId,omitempty"`
	LastStatus               MonitorLogStatus   `bson:"lastStatus,omitempty" json:"lastStatus,omitempty"`
	SSLWarning               bool               `bson:"sslWarning,omitempty" json:"sslWarning,omitempty"`
	SSLDaysRemaining         int                `bson:"sslDaysRemaining,omitempty" json:"sslDaysRemaining,omitempty"`
	SSLTriggeredThreshold    int                `bson:"sslTriggeredThreshold,omitempty" json:"sslTriggeredThreshold,omitempty"`
	DomainWarning            bool               `bson:"domainWarning,omitempty" json:"domainWarning,omitempty"`
	DomainDaysRemaining      int                `bson:"domainDaysRemaining,omitempty" json:"domainDaysRemaining,omitempty"`
	DomainTriggeredThreshold int                `bson:"domainTriggeredThreshold,omitempty" json:"domainTriggeredThreshold,omitempty"`
	LastCheckedAt            time.Time          `bson:"lastCheckedAt,omitempty" json:"lastCheckedAt,omitempty"`
	CreatedAt                time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt                time.Time          `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"`
}

type MonitorAdvancedOptions

type MonitorAdvancedOptions struct {
	DomainExpiry   bool `bson:"domain_expiry,omitempty" json:"domain_expiry,omitempty"`
	CertExpiry     bool `bson:"cert_expiry,omitempty" json:"cert_expiry,omitempty"`
	IgnoreTLSError bool `bson:"ignore_tls_error,omitempty" json:"ignore_tls_error,omitempty"`
}

type MonitorConfig

type MonitorConfig struct {
	Advanced MonitorAdvancedOptions `bson:"advanced,omitempty" json:"advanced,omitempty"`
}

type MonitorLog

type MonitorLog struct {
	ID           primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	MonitorID    primitive.ObjectID `bson:"monitorId" json:"monitorId"`
	Status       MonitorLogStatus   `bson:"status" json:"status"`
	ResponseTime int64              `bson:"responseTime" json:"responseTime"`
	StatusCode   int                `bson:"statusCode" json:"statusCode"`
	CheckedAt    time.Time          `bson:"checkedAt" json:"checkedAt"`
}

Legacy model for backward compatibility Used by old monitor logs in "monitor_logs" collection

type MonitorLogStatus

type MonitorLogStatus string
const (
	MonitorUp   MonitorLogStatus = "up"
	MonitorDown MonitorLogStatus = "down"
)

type MonitorType

type MonitorType string
const (
	MonitorHTTP MonitorType = "http"
	MonitorTCP  MonitorType = "tcp"
	MonitorDNS  MonitorType = "dns"
	MonitorPing MonitorType = "ping"
	MonitorSSL  MonitorType = "ssl"
)

type Outage

type Outage struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	MonitorID       primitive.ObjectID `bson:"monitorId" json:"monitorId"`
	ComponentID     primitive.ObjectID `bson:"componentId,omitempty" json:"componentId,omitempty"`
	SubComponentID  primitive.ObjectID `bson:"subComponentId,omitempty" json:"subComponentId,omitempty"`
	StartedAt       time.Time          `bson:"startedAt" json:"startedAt"`
	EndedAt         time.Time          `bson:"endedAt,omitempty" json:"endedAt,omitempty"`
	DurationSeconds int                `bson:"durationSeconds,omitempty" json:"durationSeconds,omitempty"`
	Status          OutageStatus       `bson:"status" json:"status"`
}

type OutageStatus

type OutageStatus string
const (
	OutageActive   OutageStatus = "active"
	OutageResolved OutageStatus = "resolved"
)

type PaginatedResult

type PaginatedResult[T any] struct {
	Items      []T   `json:"items"`
	Page       int   `json:"page"`
	Total      int64 `json:"total"`
	TotalPages int   `json:"total_pages"`
}

type RichTextDocument

type RichTextDocument = map[string]any

type StatusPageBrandingSettings

type StatusPageBrandingSettings struct {
	SiteName           string `bson:"siteName" json:"siteName"`
	LogoURL            string `bson:"logoUrl" json:"logoUrl"`
	BackgroundImageURL string `bson:"backgroundImageUrl" json:"backgroundImageUrl"`
	HeroImageURL       string `bson:"heroImageUrl" json:"heroImageUrl"`
}

type StatusPageFooterSettings

type StatusPageFooterSettings struct {
	Text          string `bson:"text" json:"text"`
	ShowPoweredBy bool   `bson:"showPoweredBy" json:"showPoweredBy"`
}

type StatusPageHeadSettings

type StatusPageHeadSettings struct {
	Title       string            `bson:"title" json:"title"`
	Description string            `bson:"description" json:"description"`
	Keywords    string            `bson:"keywords" json:"keywords"`
	FaviconURL  string            `bson:"faviconUrl" json:"faviconUrl"`
	MetaTags    map[string]string `bson:"metaTags,omitempty" json:"metaTags,omitempty"`
}

type StatusPageLayoutSettings

type StatusPageLayoutSettings struct {
	Variant string `bson:"variant" json:"variant"`
}

type StatusPageSSOSettings

type StatusPageSSOSettings struct {
	Enabled      bool   `bson:"enabled,omitempty" json:"enabled,omitempty"`
	Provider     string `bson:"provider,omitempty" json:"provider,omitempty"`
	Issuer       string `bson:"issuer,omitempty" json:"issuer,omitempty"`
	Audience     string `bson:"audience,omitempty" json:"audience,omitempty"`
	Algorithm    string `bson:"algorithm,omitempty" json:"algorithm,omitempty"`
	SharedSecret string `bson:"sharedSecret,omitempty" json:"-"`
	PublicKeyPEM string `bson:"publicKeyPem,omitempty" json:"publicKeyPem,omitempty"`
}

type StatusPageSettings

type StatusPageSettings struct {
	Key       string                     `bson:"key" json:"-"`
	Head      StatusPageHeadSettings     `bson:"head" json:"head"`
	Branding  StatusPageBrandingSettings `bson:"branding" json:"branding"`
	Theme     StatusPageThemeSettings    `bson:"theme" json:"theme"`
	Layout    StatusPageLayoutSettings   `bson:"layout" json:"layout"`
	Footer    StatusPageFooterSettings   `bson:"footer" json:"footer"`
	SSO       StatusPageSSOSettings      `bson:"sso,omitempty" json:"-"`
	CustomCSS string                     `bson:"customCss" json:"customCss"`
	UpdatedAt time.Time                  `bson:"updatedAt" json:"updatedAt"`
	CreatedAt time.Time                  `bson:"createdAt" json:"createdAt"`
}

func DefaultStatusPageSettings

func DefaultStatusPageSettings() StatusPageSettings

type StatusPageThemePalette

type StatusPageThemePalette struct {
	PrimaryColor    string `bson:"primaryColor" json:"primaryColor"`
	BackgroundColor string `bson:"backgroundColor" json:"backgroundColor"`
	TextColor       string `bson:"textColor" json:"textColor"`
	AccentColor     string `bson:"accentColor" json:"accentColor"`
}

type StatusPageThemeSettings

type StatusPageThemeSettings struct {
	Preset     string                    `bson:"preset" json:"preset"`
	Mode       string                    `bson:"mode" json:"mode"`
	Light      StatusPageThemePalette    `bson:"light" json:"light"`
	Dark       StatusPageThemePalette    `bson:"dark" json:"dark"`
	Typography StatusPageThemeTypography `bson:"typography" json:"typography"`
}

type StatusPageThemeTypography

type StatusPageThemeTypography struct {
	FontFamily string `bson:"fontFamily" json:"fontFamily"`
	FontScale  string `bson:"fontScale" json:"fontScale"`
}

type SubComponent

type SubComponent struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	ComponentID primitive.ObjectID `bson:"componentId" json:"componentId"`
	Name        string             `bson:"name" json:"name"`
	Description string             `bson:"description" json:"description"`
	Status      ComponentStatus    `bson:"status" json:"status"`
	Order       int                `bson:"order"`
	CreatedAt   time.Time          `bson:"created_at"`
	UpdatedAt   time.Time          `bson:"updated_at"`
}

type Subscriber

type Subscriber struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Email     string             `bson:"email" json:"email"`
	Verified  bool               `bson:"verified" json:"verified"`
	CreatedAt time.Time          `bson:"createdAt" json:"createdAt"`
}

type User

type User struct {
	ID                   primitive.ObjectID  `bson:"_id,omitempty" json:"id"`
	Username             string              `bson:"username" json:"username"`
	Email                string              `bson:"email" json:"email"`
	EmailHash            string              `bson:"emailHash" json:"-"`
	Role                 string              `bson:"role,omitempty" json:"role,omitempty"`
	Status               string              `bson:"status,omitempty" json:"status,omitempty"`
	MFAEnabled           bool                `bson:"mfaEnabled,omitempty" json:"mfaEnabled,omitempty"`
	SSO                  UserSSO             `bson:"sso,omitempty" json:"sso,omitempty"`
	MFASecretEnc         string              `bson:"mfaSecretEnc,omitempty" json:"-"`
	MFARecoveryCodesHash []string            `bson:"mfaRecoveryCodesHash,omitempty" json:"-"`
	LastLoginAt          *time.Time          `bson:"lastLoginAt,omitempty" json:"lastLoginAt,omitempty"`
	InvitedBy            *primitive.ObjectID `bson:"invitedBy,omitempty" json:"invitedBy,omitempty"`
	PasswordHash         string              `bson:"passwordHash" json:"-"`
	CreatedAt            time.Time           `bson:"createdAt" json:"createdAt"`
}

type UserInvitation

type UserInvitation struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	TokenHash  string             `bson:"tokenHash" json:"-"`
	Email      string             `bson:"email" json:"email"`
	EmailHash  string             `bson:"emailHash" json:"-"`
	Role       string             `bson:"role" json:"role"`
	ExpiresAt  time.Time          `bson:"expiresAt" json:"expiresAt"`
	CreatedBy  primitive.ObjectID `bson:"createdBy" json:"createdBy"`
	AcceptedAt *time.Time         `bson:"acceptedAt,omitempty" json:"acceptedAt,omitempty"`
	RevokedAt  *time.Time         `bson:"revokedAt,omitempty" json:"revokedAt,omitempty"`
	CreatedAt  time.Time          `bson:"createdAt" json:"createdAt"`
}

type UserSSO

type UserSSO struct {
	Enabled  bool   `bson:"enabled,omitempty" json:"enabled,omitempty"`
	Provider string `bson:"provider,omitempty" json:"provider,omitempty"`
}

type WebhookChannel

type WebhookChannel struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Name      string             `bson:"name" json:"name"`
	URL       string             `bson:"url" json:"url"`
	Enabled   bool               `bson:"enabled" json:"enabled"`
	CreatedAt time.Time          `bson:"createdAt" json:"createdAt"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL