alarmtag

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCreateRequest

func ValidateCreateRequest(sl validator.StructLevel)

func ValidateUpdateRequest

func ValidateUpdateRequest(sl validator.StructLevel)

Types

type API

type API interface {
	common.CrudAPI
	BulkDelete(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	transformer common.PatternFieldsTransformer,
	actionLogger logger.ActionLogger,
	logger zerolog.Logger,
) 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 BulkDeleteRequestItem

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

type CreateRequest

type CreateRequest struct {
	Value  string `json:"value" binding:"required,max=255"`
	Color  string `json:"color" binding:"required,iscolor"`
	Author string `json:"author" swaggerignore:"true"`

	common.AlarmPatternFieldsRequest
	common.EntityPatternFieldsRequest
}

type ListRequest

type ListRequest struct {
	pagination.FilteredQuery
	SortBy string   `form:"sort_by" json:"sort_by" binding:"oneoforempty=value created"`
	Values []string `form:"values[]" json:"values"`
}

type Response

type Response struct {
	ID        string           `bson:"_id" json:"_id"`
	Type      int64            `bson:"type" json:"type"`
	Value     string           `bson:"value" json:"value"`
	Color     string           `bson:"color" json:"color"`
	Author    *author.Author   `bson:"author" json:"author"`
	Updated   datetime.CpsTime `bson:"updated" json:"updated" swaggertype:"integer"`
	Created   datetime.CpsTime `bson:"created" json:"created" swaggertype:"integer"`
	Deletable *bool            `bson:"deletable,omitempty" json:"deletable,omitempty"`

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

type Store

type Store interface {
	Find(ctx context.Context, r ListRequest) (*AggregationResult, error)
	GetByID(ctx context.Context, id string) (*Response, error)
	Create(ctx context.Context, r CreateRequest) (*Response, error)
	Update(ctx context.Context, r UpdateRequest) (*Response, error)
	Delete(ctx context.Context, id string) (bool, error)
}

func NewStore

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

type UpdateRequest

type UpdateRequest struct {
	ID     string `json:"-"`
	Color  string `json:"color" binding:"required,iscolor"`
	Author string `json:"author" swaggerignore:"true"`

	common.AlarmPatternFieldsRequest
	common.EntityPatternFieldsRequest
}

Jump to

Keyboard shortcuts

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