viewgroup

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLinkedToView = errors.New("group is linked to view")

Functions

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
) common.BulkCrudAPI

Types

type AggregationResult

type AggregationResult struct {
	Data       []ViewGroup `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 {
	Title  string `json:"title" binding:"required,max=255"`
	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[]" json:"ids" binding:"required,unique,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 EditRequest

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

type ListRequest

type ListRequest struct {
	pagination.Query
	Search    string `form:"search"`
	WithViews bool   `form:"with_views"`
	WithFlags bool   `form:"with_flags"`
}

type Store

type Store interface {
	Find(r ListRequest, authorizedViewIds []string) (*AggregationResult, error)
	GetOneBy(string) (*ViewGroup, error)
	Insert([]EditRequest) ([]ViewGroup, error)
	Update([]BulkUpdateRequestItem) ([]ViewGroup, error)
	Delete([]string) (bool, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient) Store

type View

type View struct {
	ID              string                     `bson:"_id" json:"_id"`
	Enabled         bool                       `bson:"enabled" json:"enabled"`
	Title           string                     `bson:"title" json:"title"`
	Description     string                     `bson:"description" json:"description"`
	Group           ViewGroup                  `bson:"group" json:"group"`
	Tabs            []libview.Tab              `bson:"tabs" json:"tabs"`
	Tags            []string                   `bson:"tags" json:"tags"`
	PeriodicRefresh *types.DurationWithEnabled `bson:"periodic_refresh" json:"periodic_refresh"`
	Author          string                     `bson:"author" json:"author"`
	Created         *types.CpsTime             `bson:"created" json:"created" swaggertype:"integer"`
	Updated         *types.CpsTime             `bson:"updated" json:"updated" swaggertype:"integer"`
}

type ViewGroup

type ViewGroup struct {
	ID        string        `bson:"_id" json:"_id"`
	Title     string        `bson:"title" json:"title"`
	Author    string        `bson:"author" json:"author"`
	Views     *[]View       `bson:"views,omitempty" json:"views,omitempty"`
	Created   types.CpsTime `bson:"created" json:"created" swaggertype:"integer"`
	Updated   types.CpsTime `bson:"updated" json:"updated" swaggertype:"integer"`
	Deletable *bool         `bson:"deletable,omitempty" json:"deletable,omitempty"`
}

Jump to

Keyboard shortcuts

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