widgetfilter

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: 22 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 {
	common.CrudAPI
	UpdatePositions(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	enforcer security.Enforcer,
	transformer PatternFieldsTransformer,
	actionLogger logger.ActionLogger,
) API

type AggregationResult

type AggregationResult struct {
	Data       []Response `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"`

	common.AlarmPatternFieldsRequest
	common.EntityPatternFieldsRequest
	common.PbehaviorPatternFieldsRequest

	WeatherServicePattern view.WeatherServicePattern `json:"weather_service_pattern"`
}

type CreateRequest

type CreateRequest struct {
	EditRequest
	Widget string `json:"widget" 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 {
	BaseEditRequest
	IsUserPreference *bool  `json:"is_user_preference" binding:"required"`
	Author           string `json:"author" swaggerignore:"true"`
	IsPrivate        bool   `json:"-"`
}

type ListRequest

type ListRequest struct {
	pagination.Query
	Widget  string `form:"widget" json:"widget" binding:"required"`
	Private *bool  `form:"private" json:"private"`
}

type PatternFieldsTransformer

type PatternFieldsTransformer interface {
	TransformAlarmPatternFieldsRequest(ctx context.Context, r common.AlarmPatternFieldsRequest, isPrivate bool, user string) (common.AlarmPatternFieldsRequest, error)
	TransformEntityPatternFieldsRequest(ctx context.Context, r common.EntityPatternFieldsRequest, isPrivate bool, user string) (common.EntityPatternFieldsRequest, error)
	TransformPbehaviorPatternFieldsRequest(ctx context.Context, r common.PbehaviorPatternFieldsRequest, isPrivate bool, user string) (common.PbehaviorPatternFieldsRequest, error)
}

func NewPatternFieldsTransformer

func NewPatternFieldsTransformer(client mongo.DbClient) PatternFieldsTransformer

type Response

type Response struct {
	ID               string            `bson:"_id" json:"_id"`
	Widget           string            `bson:"widget" json:"-"`
	Title            string            `bson:"title" json:"title"`
	IsUserPreference bool              `bson:"is_user_preference" json:"is_user_preference"`
	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"`

	savedpattern.AlarmPatternFields     `bson:",inline"`
	savedpattern.EntityPatternFields    `bson:",inline"`
	savedpattern.PbehaviorPatternFields `bson:",inline"`

	WeatherServicePattern view.WeatherServicePattern `bson:"weather_service_pattern" json:"weather_service_pattern,omitempty"`

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

type Store

type Store interface {
	Find(ctx context.Context, r ListRequest, userId string) (*AggregationResult, error)
	FindViewId(ctx context.Context, id string) (string, string, bool, error)
	FindViewIdByWidget(ctx context.Context, widgetId string) (string, string, bool, error)
	GetOneBy(ctx context.Context, id, userId 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)
	UpdatePositions(ctx context.Context, filters []string, widgetId, userId string, isPrivate bool) (bool, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient, authorProvider author.Provider) 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

type Validator

type Validator struct {
}

func NewValidator

func NewValidator() *Validator

func (*Validator) ValidateCreateRequest

func (v *Validator) ValidateCreateRequest(sl validator.StructLevel)

func (*Validator) ValidatePatterns

func (v *Validator) ValidatePatterns(sl validator.StructLevel, r BaseEditRequest)

func (*Validator) ValidateUpdateRequest

func (v *Validator) ValidateUpdateRequest(sl validator.StructLevel)

Jump to

Keyboard shortcuts

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