colortheme

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Canopsis       = "canopsis"
	CanopsisDark   = "canopsis_dark"
	ColorBlind     = "color_blind"
	ColorBlindDark = "color_blind_dark"
)

Variables

View Source
var ErrDefaultTheme = errors.New("can't modify or delete the default color theme")

Functions

This section is empty.

Types

type API

type API interface {
	common.CrudAPI
	BulkDelete(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
	logger zerolog.Logger,
) API

type AggregationResult

type AggregationResult struct {
	Data       []Theme `bson:"data" json:"data"`
	TotalCount int64   `bson:"total_count" json:"total_count"`
}

func (*AggregationResult) GetData

func (r *AggregationResult) GetData() interface{}

func (*AggregationResult) GetTotal

func (r *AggregationResult) GetTotal() int64

type BulkDeleteRequestItem

type BulkDeleteRequestItem struct {
	ID string `json:"_id" binding:"required"`
}

type Colors

type Colors struct {
	Main struct {
		Primary     string `bson:"primary" json:"primary" binding:"required,iscolor"`
		Secondary   string `bson:"secondary" json:"secondary" binding:"required,iscolor"`
		Accent      string `bson:"accent" json:"accent" binding:"required,iscolor"`
		Error       string `bson:"error" json:"error" binding:"required,iscolor"`
		Info        string `bson:"info" json:"info" binding:"required,iscolor"`
		Success     string `bson:"success" json:"success" binding:"required,iscolor"`
		Warning     string `bson:"warning" json:"warning" binding:"required,iscolor"`
		Background  string `bson:"background" json:"background" binding:"required,iscolor"`
		ActiveColor string `bson:"active_color" json:"active_color" binding:"required,iscolor"`
	} `bson:"main" json:"main"`
	Table struct {
		Background    string `bson:"background" json:"background" binding:"required,iscolor"`
		RowColor      string `bson:"row_color" json:"row_color" binding:"required,iscolor"`
		ShiftRowColor string `bson:"shift_row_color,omitempty" json:"shift_row_color,omitempty" binding:"iscolororempty"`
		HoverRowColor string `bson:"hover_row_color,omitempty" json:"hover_row_color,omitempty" binding:"iscolororempty"`
	} `bson:"table" json:"table"`
	State struct {
		OK       string `bson:"ok" json:"ok" binding:"required,iscolor"`
		Minor    string `bson:"minor" json:"minor" binding:"required,iscolor"`
		Major    string `bson:"major" json:"major" binding:"required,iscolor"`
		Critical string `bson:"critical" json:"critical" binding:"required,iscolor"`
	} `bson:"state" json:"state"`
}

type EditRequest

type EditRequest struct {
	ID       string `bson:"_id" json:"-"`
	Name     string `bson:"name" json:"name" binding:"required"`
	Colors   Colors `bson:"colors" json:"colors"`
	FontSize int    `bson:"font_size" json:"font_size" binding:"required,oneof=1 2 3"`
}

type FilteredQuery

type FilteredQuery struct {
	pagination.FilteredQuery
	SortBy string `json:"sort_by" form:"sort_by" binding:"oneoforempty=name updated"`
}

type Store

type Store interface {
	Insert(ctx context.Context, r EditRequest) (*Theme, error)
	GetById(ctx context.Context, id string) (*Theme, error)
	Find(ctx context.Context, query FilteredQuery) (*AggregationResult, error)
	Update(ctx context.Context, r EditRequest) (*Theme, error)
	Delete(ctx context.Context, id string) (bool, error)
}

func NewStore

func NewStore(
	dbClient libmongo.DbClient,
) Store

type Theme

type Theme struct {
	ID        string           `bson:"_id" json:"_id"`
	Name      string           `bson:"name" json:"name"`
	Colors    Colors           `bson:"colors" json:"colors"`
	FontSize  int              `bson:"font_size" json:"font_size"`
	Updated   datetime.CpsTime `bson:"updated" json:"updated" swaggertype:"integer"`
	Deletable bool             `bson:"deletable" json:"deletable"`
}

Jump to

Keyboard shortcuts

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