models

package
v0.0.0-...-cf4efce Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: AGPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertEndpoints

type AlertEndpoints struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Endpoint string `json:"endpoint"`
	Icon     string `json:"icon"`
	Color    string `json:"color"`
}

type Alerts

type Alerts struct {
	bun.BaseModel `bun:"table:alerts"`

	ID          uuid.UUID       `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	Name        string          `bun:"name,type:text,default:''" json:"name"`
	Status      string          `bun:"status,type:text,default:''" json:"status"`
	Payload     json.RawMessage `bun:"payload,type:jsonb,default:jsonb('[]')" json:"payload"`
	FlowID      string          `bun:"flow_id,type:text,default:''" json:"flow_id"`
	ExecutionID string          `bun:"execution_id,type:text,default:''" json:"execution_id"`
	RunnerID    string          `bun:"runner_id,type:text,default:''" json:"runner_id"`
	ParentID    string          `bun:"parent_id,type:text,default:''" json:"parent_id"`
	Plugin      string          `bun:"plugin,type:text,default:''" json:"plugin"`
	CreatedAt   time.Time       `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
	Encrypted   bool            `bun:"encrypted,type:bool,default:false" json:"encrypted"`
	UpdatedAt   time.Time       `bun:"updated_at,type:timestamptz" json:"updated_at"`
	ResolvedAt  time.Time       `bun:"resolved_at,type:timestamptz" json:"resolved_at"`
	GroupKey    string          `bun:"group_key,type:text,default:''" json:"group_key"`
	SubAlerts   []SubAlerts     `bun:"sub_alerts,type:jsonb,default:jsonb('[]')" json:"sub_alerts"`
	Note        string          `bun:"note,type:text,default:''" json:"note"`
}

type Audit

type Audit struct {
	bun.BaseModel `bun:"table:audit"`

	ID        uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	ProjectID string    `bun:"project_id,type:text,notnull" json:"project_id"`
	UserID    string    `bun:"user_id,type:text,notnull" json:"user_id"`
	Operation string    `bun:"operation,type:text,notnull" json:"operation"`
	Details   string    `bun:"details,type:text,default:''" json:"details"`
	CreatedAt time.Time `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
}

type AuditWithUser

type AuditWithUser struct {
	bun.BaseModel `bun:"table:audit"`

	ID        uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	ProjectID string    `bun:"project_id,type:text,notnull" json:"project_id"`
	UserID    string    `bun:"user_id,type:text,notnull" json:"user_id"`
	Operation string    `bun:"operation,type:text,notnull" json:"operation"`
	Details   string    `bun:"details,type:text,default:''" json:"details"`
	CreatedAt time.Time `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
	Username  string    `bun:"username,type:text" json:"username"`
	Email     string    `bun:"email,type:text" json:"email"`
	Role      string    `bun:"role,type:text" json:"role"`
}

type ExecutionSteps

type ExecutionSteps struct {
	shared_models.ExecutionSteps
}

type Executions

type Executions struct {
	shared_models.Executions
	AlertID string `bun:"alert_id,type:text,default:''" json:"alert_id"`
}

type Flows

type Flows struct {
	shared_models.Flows
	Patterns              []Pattern `bun:"type:jsonb,default:jsonb('[]')" json:"patterns"`
	EncryptAlerts         bool      `bun:"encrypt_alerts,type:bool,default:true" json:"encrypt_alerts"`
	GroupAlerts           bool      `bun:"group_alerts,type:bool,default:true" json:"group_alerts"`
	GroupAlertsIdentifier string    `bun:"group_alerts_identifier,type:text,default:''" json:"group_alerts_identifier"`
	AlertThreshold        int       `bun:"alert_threshold,type:int,default:0" json:"alert_threshold"`
}

type IncExpireTokenRequest

type IncExpireTokenRequest struct {
	ExpiresIn   int    `json:"expires_in"`
	Description string `json:"description"`
}

type IncomingGroupedAlertsRequest

type IncomingGroupedAlertsRequest struct {
	FlowID                string `json:"flow_id"`
	GroupAlertsIdentifier string `json:"group_alerts_identifier"`
}

type JWTClaim

type JWTClaim struct {
	ID   uuid.UUID `json:"id"`
	Type string    `json:"type"`
	jwt.RegisteredClaims
}

type JWTProjectClaim

type JWTProjectClaim struct {
	ProjectID string    `json:"project_id"`
	ID        uuid.UUID `json:"id"`
	Type      string    `json:"type"`
	jwt.RegisteredClaims
}

type JWTProjectRunnerClaim

type JWTProjectRunnerClaim struct {
	RunnerID  string    `json:"runner_id"`
	ProjectID string    `json:"project_id"`
	ID        uuid.UUID `json:"id"`
	Type      string    `json:"type"`
	jwt.RegisteredClaims
}

type Notifications

type Notifications struct {
	bun.BaseModel `bun:"table:notifications"`

	ID         uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	UserID     string    `bun:"user_id,type:text,notnull" json:"user_id"`
	Title      string    `bun:"title,type:text,notnull" json:"title"`
	Body       string    `bun:"body,type:text,default:''" json:"body"`
	IsRead     bool      `bun:"is_read,type:bool,default:false" json:"is_read"`
	IsArchived bool      `bun:"is_archived,type:bool,default:false" json:"is_archived"`
	Icon       string    `bun:"icon,type:text,default:''" json:"icon"`
	Color      string    `bun:"color,type:text,default:'primary'" json:"color"`
	Link       string    `bun:"link,type:text,default:''" json:"link"`
	LinkText   string    `bun:"link_text,type:text,default:''" json:"link_text"`
	CreatedAt  time.Time `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
}

type Pattern

type Pattern struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Type  string `json:"type"`
}

type PlanCountStats

type PlanCountStats struct {
	Plan  string `json:"plan"`
	Count int    `json:"count"`
}

type ProjectMembers

type ProjectMembers struct {
	bun.BaseModel `bun:"table:project_members"`

	ID             uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	UserID         string    `bun:"user_id,type:text,notnull" json:"user_id"`
	ProjectID      string    `bun:"project_id,type:text,notnull" json:"project_id"`
	Role           string    `bun:"role,type:text,notnull" json:"role"`
	Disabled       bool      `bun:"disabled,type:bool,default:false" json:"disabled"`
	DisabledReason string    `bun:"disabled_reason,type:text,default:''" json:"disabled_reason"`
	InvitePending  bool      `bun:"invite_pending,type:bool,default:false" json:"invite_pending"`
	InvitedAt      time.Time `bun:"invited_at,type:timestamptz,default:now()" json:"invited_at"`
}

type ProjectMembersWithUserData

type ProjectMembersWithUserData struct {
	bun.BaseModel `bun:"table:project_members"`

	ID             uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	UserID         string    `bun:"user_id,type:text,notnull" json:"user_id"`
	ProjectID      string    `bun:"project_id,type:text,notnull" json:"project_id"`
	Role           string    `bun:"role,type:text,notnull" json:"role"`
	Disabled       bool      `bun:"disabled,type:bool,default:false" json:"disabled"`
	DisabledReason string    `bun:"disabled_reason,type:text,default:''" json:"disabled_reason"`
	InvitePending  bool      `bun:"invite_pending,type:bool,default:false" json:"invite_pending"`
	InvitedAt      time.Time `bun:"invited_at,type:timestamptz,default:now()" json:"invited_at"`
	Username       string    `bun:"username,type:text" json:"username"`
	Email          string    `bun:"email,type:text" json:"email"`
}

type Projects

type Projects struct {
	bun.BaseModel `bun:"table:projects"`

	ID                  uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	Name                string    `bun:"name,type:text,notnull" json:"name"`
	Description         string    `bun:"description,type:text,default:''" json:"description"`
	SharedRunners       bool      `bun:"shared_runners,type:bool,default:false" json:"shared_runners"`
	Color               string    `bun:"color,type:text,default:''" json:"color"`
	Icon                string    `bun:"icon,type:text,default:''" json:"icon"`
	Disabled            bool      `bun:"disabled,type:bool,default:false" json:"disabled"`
	DisabledReason      string    `bun:"disabled_reason,type:text,default:''" json:"disabled_reason"`
	CreatedAt           time.Time `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
	EnableAutoRunners   bool      `bun:"enable_auto_runners,type:bool,default:false" json:"enable_auto_runners"`
	DisableRunnerJoin   bool      `bun:"disable_runner_join,type:bool,default:false" json:"disable_runner_join"`
	RunnerAutoJoinToken string    `bun:"runner_auto_join_token,type:text,notnull" json:"runner_auto_join_token"`
}

type RoleCountStats

type RoleCountStats struct {
	Role  string `json:"role"`
	Count int    `json:"count"`
}

type Runners

type Runners struct {
	shared_models.Runners
}

type Settings

type Settings struct {
	bun.BaseModel `bun:"table:settings"`

	Maintenance               bool   `bun:"maintenance,type:bool,default:false" json:"maintenance"`
	SignUp                    bool   `bun:"signup,type:bool,default:true" json:"signup"`
	CreateProjects            bool   `bun:"create_projects,type:bool,default:true" json:"create_projects"`
	CreateFlows               bool   `bun:"create_flows,type:bool,default:true" json:"create_flows"`
	CreateRunners             bool   `bun:"create_runners,type:bool,default:true" json:"create_runners"`
	CreateApiKeys             bool   `bun:"create_api_keys,type:bool,default:true" json:"create_api_keys"`
	AddProjectMembers         bool   `bun:"add_project_members,type:bool,default:true" json:"add_project_members"`
	AddFlowActions            bool   `bun:"add_flow_actions,type:bool,default:true" json:"add_flow_actions"`
	StartExecutions           bool   `bun:"start_executions,type:bool,default:true" json:"start_executions"`
	ReceiveAlerts             bool   `bun:"receive_alerts,type:bool,default:true" json:"receive_alerts"`
	ID                        int    `bun:"id,type:integer,pk,default:1" json:"id"`
	AllowSharedRunnerAutoJoin bool   `bun:"allow_shared_runner_auto_join,type:bool,default:true" json:"allow_shared_runner_auto_join"`
	AllowSharedRunnerJoin     bool   `bun:"allow_shared_runner_join,type:bool,default:true" json:"allow_shared_runner_join"`
	SharedRunnerAutoJoinToken string `bun:"shared_runner_auto_join_token,type:text,default:''" json:"shared_runner_auto_join_token"`
}

type Stats

type Stats struct {
	Key   string `json:"key"`
	Value int    `json:"value"`
}

type StatsAlertExecutions

type StatsAlertExecutions struct {
	Key        string `json:"key"`
	Alerts     int    `json:"alerts"`
	Executions int    `json:"executions"`
}

type StatsAlertExecutionsTotals

type StatsAlertExecutionsTotals struct {
	AlertCount     int   `json:"total_alerts"`
	ExecutionCount int   `json:"total_executions"`
	AlertTrend     Trend `json:"alert_trend"`
	ExecutionTrend Trend `json:"execution_trend"`
}

type SubAlerts

type SubAlerts struct {
	ID         string          `json:"id"`
	Name       string          `json:"name"`
	Status     string          `json:"status"`
	Labels     json.RawMessage `json:"labels"`
	StartedAt  time.Time       `json:"started_at"`
	ResolvedAt time.Time       `json:"resolved_at"`
}

type Tokens

type Tokens struct {
	bun.BaseModel `bun:"table:tokens"`

	ID             uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	ProjectID      string    `bun:"project_id,type:text,default:''" json:"project_id"`
	Key            string    `bun:"key,type:text,notnull" json:"key"`
	Description    string    `bun:"description,type:text,default:''" json:"description"`
	Type           string    `bun:"type,type:text,notnull" json:"type"`
	Disabled       bool      `bun:"disabled,type:bool,default:false" json:"disabled"`
	DisabledReason string    `bun:"disabled_reason,type:text,default:''" json:"disabled_reason"`
	CreatedAt      time.Time `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
	ExpiresAt      time.Time `bun:"expires_at,type:timestamptz" json:"expires_at"`
	UserID         string    `bun:"user_id,type:text,default:''" json:"user_id"`
}

type Trend

type Trend struct {
	Direction  string  `json:"direction"`
	Percentage float64 `json:"percentage"`
}

type Users

type Users struct {
	bun.BaseModel `bun:"table:users"`

	ID             uuid.UUID `bun:",pk,type:uuid,default:gen_random_uuid()" json:"id"`
	Username       string    `bun:"username,type:text,notnull" json:"username"`
	Email          string    `bun:"email,type:text,notnull" json:"email"`
	EmailVerified  bool      `bun:"email_verified,type:bool,default:false" json:"email_verified"`
	Welcomed       bool      `bun:"welcomed,type:bool,default:false" json:"welcomed"`
	Password       string    `bun:"password,type:text,notnull" json:"password"`
	Role           string    `bun:"role,type:text,notnull,default:'user'" json:"role"`
	Plan           string    `bun:"plan,type:text,notnull,default:'hobby'" json:"plan"`
	CustomerID     string    `bun:"customer_id,type:text,default:''" json:"customer_id"`
	DefaultCard    string    `bun:"default_card,type:text,default:''" json:"default_card"`
	SubscriptionID string    `bun:"subscription_id,type:text,default:''" json:"subscription_id"`
	PriceID        string    `bun:"price_id,type:text,default:''" json:"price_id"`
	PlanValidUntil time.Time `bun:"plan_valid_until,type:timestamptz" json:"plan_valid_until"`
	Disabled       bool      `bun:"disabled,type:bool,default:false" json:"disabled"`
	DisabledReason string    `bun:"disabled_reason,type:text,default:''" json:"disabled_reason"`
	CreatedAt      time.Time `bun:"created_at,type:timestamptz,default:now()" json:"created_at"`
	UpdatedAt      time.Time `bun:"updated_at,type:timestamptz" json:"updated_at"`
}

func (*Users) CheckPassword

func (user *Users) CheckPassword(providedPassword string) error

func (*Users) HashPassword

func (user *Users) HashPassword(password string) error

Jump to

Keyboard shortcuts

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