viewtab

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Create(c *gin.Context)
	Get(c *gin.Context)
	Update(c *gin.Context)
	Delete(c *gin.Context)
	Copy(c *gin.Context)
	UpdatePositions(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	enforcer security.Enforcer,
) API

type CreateRequest

type CreateRequest struct {
	EditRequest
	View string `json:"view" binding:"required"`
}

type EditPositionRequest

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

func (EditPositionRequest) MarshalJSON

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

func (*EditPositionRequest) UnmarshalJSON

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

type EditRequest

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

type Response

type Response struct {
	ID       string             `bson:"_id" json:"_id,omitempty"`
	Title    string             `bson:"title" json:"title"`
	View     string             `bson:"view" json:"-"`
	Position int64              `bson:"position" json:"-"`
	Widgets  *[]widget.Response `bson:"widgets" json:"widgets,omitempty"`
	Author   *author.Author     `bson:"author" json:"author,omitempty"`
	Created  *datetime.CpsTime  `bson:"created" json:"created,omitempty" swaggertype:"integer"`
	Updated  *datetime.CpsTime  `bson:"updated" json:"updated,omitempty" swaggertype:"integer"`

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

type Store

type Store interface {
	Find(ctx context.Context, ids []string) ([]Response, error)
	GetOneBy(ctx context.Context, id string) (*Response, error)
	Insert(ctx context.Context, r CreateRequest) (*Response, error)
	Update(ctx context.Context, r UpdateRequest) (*Response, error)
	Delete(ctx context.Context, id, userID string) (bool, error)
	Copy(ctx context.Context, tabID string, r CreateRequest) (*Response, error)
	CopyForView(ctx context.Context, viewID, newViewID, author string, isPrivate bool) error
	UpdatePositions(ctx context.Context, tabs []Response) (bool, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient, widgetStore widget.Store, authorProvider author.Provider, enforcer security.Enforcer) Store

type UpdateRequest

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

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

func (ValidationError) Error

func (v ValidationError) Error() string

func (ValidationError) Unwrap

func (v ValidationError) Unwrap() error

Jump to

Keyboard shortcuts

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