viewgroup

package
v0.0.0-...-5167e8f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: AGPL-3.0 Imports: 17 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,
) common.CrudAPI

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 EditRequest

type EditRequest struct {
	ID     string `json:"-"`
	Title  string `json:"title" binding:"required,max=255"`
	Author string `json:"author" swaggerignore:"true"`
}

type ListRequest

type ListRequest struct {
	pagination.Query
	Search      string `form:"search" json:"search"`
	WithViews   bool   `form:"with_views" json:"with_views"`
	WithTabs    bool   `form:"with_tabs" json:"with_tabs"`
	WithWidgets bool   `form:"with_widgets" json:"with_widgets"`
	WithFlags   bool   `form:"with_flags" json:"with_flags"`
	WithPrivate bool   `form:"with_private" json:"with_private"`

	UserID string `form:"-" json:"-"`
}

type Store

type Store interface {
	Find(ctx context.Context, r ListRequest, authorizedViewIds, ownedPrivateIds []string) (*AggregationResult, error)
	GetOneBy(ctx context.Context, id string) (*ViewGroup, error)
	Insert(ctx context.Context, r EditRequest) (*ViewGroup, error)
	Update(ctx context.Context, r EditRequest) (*ViewGroup, error)
	Delete(ctx context.Context, id, userID string) (bool, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient, authorProvider author.Provider) Store

type Validator

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

func NewValidator

func NewValidator(dbClient mongo.DbClient) Validator

type ViewGroup

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

	IsPrivate bool `bson:"is_private" json:"is_private"`
}

Jump to

Keyboard shortcuts

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