view

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateEditPositionRequest

func ValidateEditPositionRequest(sl validator.StructLevel)

func ValidateWidgetParametersJunitRequest

func ValidateWidgetParametersJunitRequest(sl validator.StructLevel)

Types

type API

type API interface {
	common.BulkCrudAPI
	UpdatePositions(c *gin.Context)
}

func NewApi

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

type AggregationResult

type AggregationResult struct {
	Data       []viewgroup.View `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 BaseEditRequest

type BaseEditRequest struct {
	Enabled         *bool                      `json:"enabled" binding:"required"`
	Title           string                     `json:"title" binding:"required,max=255"`
	Description     string                     `json:"description" binding:"max=255"`
	Group           string                     `json:"group" binding:"required"`
	Tabs            []TabRequest               `json:"tabs" binding:"dive"`
	Tags            []string                   `json:"tags"`
	PeriodicRefresh *types.DurationWithEnabled `json:"periodic_refresh"`
	Author          string                     `json:"author" swaggerignore:"true"`
}

type BulkCreateRequest

type BulkCreateRequest struct {
	Items []EditRequest `binding:"required,notblank,dive"`
}

func (BulkCreateRequest) MarshalJSON

func (r BulkCreateRequest) MarshalJSON() ([]byte, error)

func (*BulkCreateRequest) UnmarshalJSON

func (r *BulkCreateRequest) UnmarshalJSON(b []byte) error

type BulkDeleteRequest

type BulkDeleteRequest struct {
	IDs []string `form:"ids[]" binding:"required,notblank"`
}

type BulkUpdateRequest

type BulkUpdateRequest struct {
	Items []BulkUpdateRequestItem `binding:"required,notblank,dive"`
}

func (BulkUpdateRequest) MarshalJSON

func (r BulkUpdateRequest) MarshalJSON() ([]byte, error)

func (*BulkUpdateRequest) UnmarshalJSON

func (r *BulkUpdateRequest) UnmarshalJSON(b []byte) error

type BulkUpdateRequestItem

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

type EditPositionItemRequest

type EditPositionItemRequest struct {
	ID    string   `json:"_id" binding:"required"`
	Views []string `json:"views" binding:"required"`
}

type EditPositionRequest

type EditPositionRequest struct {
	Items []EditPositionItemRequest `json:"items" binding:"required,notblank,dive"`
}

func (EditPositionRequest) MarshalJSON

func (r EditPositionRequest) MarshalJSON() ([]byte, error)

func (*EditPositionRequest) UnmarshalJSON

func (r *EditPositionRequest) UnmarshalJSON(b []byte) error

type EditRequest

type EditRequest struct {
	BaseEditRequest
	ID string `json:"-"`
}

type ListRequest

type ListRequest struct {
	pagination.Query
	Search string   `form:"search"`
	Ids    []string `form:"-"`
}

type Store

type Store interface {
	Find(r ListRequest) (*AggregationResult, error)
	GetOneBy(r string) (*viewgroup.View, error)
	Insert(userID string, r []EditRequest) ([]viewgroup.View, error)
	Update([]BulkUpdateRequestItem) ([]viewgroup.View, error)
	// UpdatePositions receives some groups and views with updated positions and updates
	// positions for all groups and views in db and moves views to another groups if necessary.
	UpdatePositions(r EditPositionRequest) (bool, error)
	Delete(id []string) (bool, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient) Store

type TabRequest

type TabRequest struct {
	ID      string          `json:"_id" binding:"required,max=255"`
	Title   string          `json:"title" binding:"required,max=255"`
	Widgets []WidgetRequest `json:"widgets" binding:"dive"`
}

type Validator

type Validator interface {
	ValidateEditRequest(ctx context.Context, sl validator.StructLevel)
}

func NewValidator

func NewValidator(dbClient mongo.DbClient) Validator

type WidgetParametersJunitRequest

type WidgetParametersJunitRequest struct {
	IsAPI                 bool                   `json:"is_api" mapstructure:"is_api"`
	Directory             string                 `json:"directory" mapstructure:"directory"`
	ScreenshotDirectories []string               `json:"screenshot_directories" mapstructure:"screenshot_directories"`
	VideoDirectories      []string               `json:"video_directories" mapstructure:"video_directories"`
	ScreenshotFilemask    string                 `json:"screenshot_filemask" mapstructure:"screenshot_filemask"`
	VideoFilemask         string                 `json:"video_filemask" mapstructure:"video_filemask"`
	RemainParameters      map[string]interface{} `json:"-" mapstructure:",remain"`
}

func (WidgetParametersJunitRequest) MarshalJSON

func (w WidgetParametersJunitRequest) MarshalJSON() ([]byte, error)

type WidgetRequest

type WidgetRequest struct {
	ID             string                 `json:"_id" binding:"required,max=255"`
	Title          string                 `json:"title" binding:"max=255"`
	Type           string                 `json:"type" binding:"required,max=255"`
	GridParameters map[string]interface{} `json:"grid_parameters"`
	Parameters     interface{}            `json:"parameters"`
}

func (*WidgetRequest) UnmarshalJSON

func (w *WidgetRequest) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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