icon

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
	Patch(c *gin.Context)
}

func NewApi

func NewApi(
	store Store,
	websocketHub websocket.Hub,
	actionLogger logger.ActionLogger,
	maxSize int64,
	mimeTypes []string,
) 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 EditRequest

type EditRequest struct {
	ID       string                `form:"-"`
	Title    string                `form:"title" binding:"required,max=255"`
	File     *multipart.FileHeader `form:"file" binding:"required"`
	MimeType string                `form:"-"`
}

type PatchRequest

type PatchRequest struct {
	ID       string                `form:"-"`
	Title    string                `form:"title" binding:"max=255"`
	File     *multipart.FileHeader `form:"file"`
	MimeType string                `form:"-"`
}

type Response

type Response struct {
	ID      string           `bson:"_id" json:"_id"`
	Title   string           `bson:"title" json:"title"`
	Created datetime.CpsTime `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"`
	Updated datetime.CpsTime `bson:"updated,omitempty" json:"updated,omitempty" swaggertype:"integer"`

	Storage  string `bson:"storage" json:"-"`
	Etag     string `bson:"etag" json:"-"`
	MimeType string `bson:"mime_type" json:"-"`

	Content string `bson:"-" json:"content,omitempty"`
}

type Store

type Store interface {
	Create(context.Context, EditRequest) (*Response, error)
	Update(context.Context, EditRequest) (*Response, error)
	Patch(context.Context, PatchRequest) (*Response, error)
	Delete(ctx context.Context, id string) (bool, error)
	List(ctx context.Context, query pagination.FilteredQuery) (*AggregationResult, error)
	Get(ctx context.Context, id string) (*Response, error)
	GetFilepath(model Response) string
}

func NewStore

func NewStore(dbClient mongo.DbClient, storage libfile.Storage) Store

Jump to

Keyboard shortcuts

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