pref

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPrefNotFound = errors.New("preference not found")
View Source
var ErrUnknownCookieType = errutil.BadRequest(
	"preferences.unknownCookieType",
	errutil.WithPublicMessage("Got an unknown cookie preference type. Expected a set containing one or more of 'functional', 'performance', or 'analytics'}"),
)

Functions

func IsValidThemeID

func IsValidThemeID(id string) bool

Types

type CookieType

type CookieType string

swagger:model Enum: analytics,performance,functional

type GetPreferenceQuery

type GetPreferenceQuery struct {
	OrgID  int64
	UserID int64
	TeamID int64
}

type GetPreferenceWithDefaultsQuery

type GetPreferenceWithDefaultsQuery struct {
	Teams  []int64
	OrgID  int64
	UserID int64
}

type PatchPreferenceCommand

type PatchPreferenceCommand struct {
	UserID int64
	OrgID  int64
	TeamID int64

	HomeDashboardID   *int64                  `json:"homeDashboardId,omitempty"`
	HomeDashboardUID  *string                 `json:"homeDashboardUID,omitempty"`
	Timezone          *string                 `json:"timezone,omitempty"`
	WeekStart         *string                 `json:"weekStart,omitempty"`
	Theme             *string                 `json:"theme,omitempty"`
	Language          *string                 `json:"language,omitempty"`
	QueryHistory      *QueryHistoryPreference `json:"queryHistory,omitempty"`
	CookiePreferences []CookieType            `json:"cookiePreferences,omitempty"`
}

type Preference

type Preference struct {
	ID              int64               `xorm:"pk autoincr 'id'" db:"id"`
	OrgID           int64               `xorm:"org_id" db:"org_id"`
	UserID          int64               `xorm:"user_id" db:"user_id"`
	TeamID          int64               `xorm:"team_id" db:"team_id"`
	Teams           []int64             `xorm:"extends"`
	Version         int                 `db:"version"`
	HomeDashboardID int64               `xorm:"home_dashboard_id" db:"home_dashboard_id"`
	Timezone        string              `db:"timezone"`
	WeekStart       *string             `db:"week_start"`
	Theme           string              `db:"theme"`
	Created         time.Time           `db:"created"`
	Updated         time.Time           `db:"updated"`
	JSONData        *PreferenceJSONData `xorm:"json_data" db:"json_data"`
}

func (Preference) Cookies

func (p Preference) Cookies(typ string) bool

func (Preference) TableName

func (p Preference) TableName() string

type PreferenceJSONData

type PreferenceJSONData struct {
	Language          string                 `json:"language"`
	QueryHistory      QueryHistoryPreference `json:"queryHistory"`
	CookiePreferences map[string]struct{}    `json:"cookiePreferences"`
}

func (*PreferenceJSONData) FromDB

func (j *PreferenceJSONData) FromDB(data []byte) error

func (*PreferenceJSONData) Scan

func (j *PreferenceJSONData) Scan(val any) error

func (*PreferenceJSONData) ToDB

func (j *PreferenceJSONData) ToDB() ([]byte, error)

func (*PreferenceJSONData) Value

func (j *PreferenceJSONData) Value() (driver.Value, error)

type QueryHistoryPreference

type QueryHistoryPreference struct {
	HomeTab string `json:"homeTab"`
}

type SavePreferenceCommand

type SavePreferenceCommand struct {
	UserID int64
	OrgID  int64
	TeamID int64

	HomeDashboardID   int64                   `json:"homeDashboardId,omitempty"`
	HomeDashboardUID  *string                 `json:"homeDashboardUID,omitempty"`
	Timezone          string                  `json:"timezone,omitempty"`
	WeekStart         string                  `json:"weekStart,omitempty"`
	Theme             string                  `json:"theme,omitempty"`
	Language          string                  `json:"language,omitempty"`
	QueryHistory      *QueryHistoryPreference `json:"queryHistory,omitempty"`
	CookiePreferences []CookieType            `json:"cookiePreferences,omitempty"`
}

type ThemeDTO

type ThemeDTO struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	IsExtra bool   `json:"isExtra"`
}

func GetThemeByID

func GetThemeByID(id string) *ThemeDTO

Directories

Path Synopsis
shared logic between httpserver and teamapi
shared logic between httpserver and teamapi

Jump to

Keyboard shortcuts

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