entitycomment

package
v0.0.0-...-8a398ea Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: AGPL-3.0 Imports: 15 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 {
	List(*gin.Context)
	Create(*gin.Context)
	Update(*gin.Context)
}

func NewApi

func NewApi(
	store Store,
) 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 Comment

type Comment struct {
	Timestamp datetime.CpsTime `bson:"t" json:"t" swaggertype:"integer"`
	Author    *types.Author    `bson:"a" json:"author"`
	Message   string           `bson:"m" json:"message"`
}

type ListRequest

type ListRequest struct {
	pagination.Query
	Entity string `form:"entity" json:"entity" binding:"required"`
}

type Request

type Request struct {
	Message string `json:"message" binding:"required,max=200"`
	Entity  string `json:"entity" binding:"required"`
}

type Response

type Response struct {
	ID      string `bson:"_id" json:"_id"`
	Entity  string `json:"entity,omitempty"`
	Comment `bson:",inline" json:",inline"`
}

type Store

type Store interface {
	Find(context.Context, ListRequest) (*AggregationResult, error)
	Insert(ctx context.Context, r Request, userID, username string) (*Response, error)
	Update(ctx context.Context, r UpdateRequest, userID, username string) (*Response, error)
}

func NewStore

func NewStore(dbClient mongo.DbClient, logger zerolog.Logger) Store

type UpdateRequest

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

Jump to

Keyboard shortcuts

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