broadcastmessage

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator(dbClient mongo.DbClient) *broadcastMessageValidator

Types

type API

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

func NewApi

func NewApi(
	store Store,
	actionLogger logger.ActionLogger,
) API

type AggregationResult

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

type BroadcastMessage struct {
	ID                      string `bson:"_id" json:"_id" binding:"id"`
	BroadcastMessagePayload `bson:",inline"`
}

type BroadcastMessagePayload

type BroadcastMessagePayload struct {
	Color   string        `bson:"color" json:"color" binding:"required,iscolor"`
	Message string        `bson:"message" json:"message" binding:"required"`
	Start   types.CpsTime `bson:"start" json:"start" binding:"required" swaggertype:"integer"`
	End     types.CpsTime `bson:"end" json:"end" binding:"required" swaggertype:"integer"`

	Created *types.CpsTime `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"`
	Updated *types.CpsTime `bson:"updated,omitempty" json:"updated,omitempty" swaggertype:"integer"`
}

type FilteredQuery

type FilteredQuery struct {
	pagination.FilteredQuery
	SortBy string `json:"sort_by" form:"sort_by" binding:"oneoforempty=_id message"`
}

type Store

type Store interface {
	Insert(model *BroadcastMessage) error
	GetById(id string) (*BroadcastMessage, error)
	Find(query FilteredQuery) (*AggregationResult, error)
	Update(model *BroadcastMessage) (bool, error)
	Delete(id string) (bool, error)
	GetActive() ([]*BroadcastMessage, error)
}

func NewStore

func NewStore(
	dbClient mongo.DbClient,
) Store

Jump to

Keyboard shortcuts

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