file

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: 17 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)
	Get(*gin.Context)
	Delete(*gin.Context)
}

func NewApi

func NewApi(enforcer security.Enforcer, store Store) API

type CreateRequest

type CreateRequest struct {
	Public bool `form:"public" json:"public"`
}

type File

type File struct {
	ID        string           `bson:"_id" json:"_id"`
	FileName  string           `bson:"filename" json:"filename"`
	MediaType string           `bson:"mediatype" json:"mediatype"`
	Created   datetime.CpsTime `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"`
	Storage   string           `bson:"storage" json:"-"`
	Etag      string           `bson:"etag" json:"-"`
	IsPublic  bool             `bson:"is_public" json:"-"`
}

type Store

type Store interface {
	Create(context.Context, bool, *multipart.Form) ([]File, error)
	Delete(ctx context.Context, id string) (bool, error)
	List(ctx context.Context, ids []string) ([]File, error)
	Get(ctx context.Context, id string) (*File, error)
	GetFilepath(model File) string
}

Store interface consists of helpers for api handlers

func NewStore

func NewStore(dbClient mongo.DbClient, storage file.Storage, maxSize int64) Store

NewStore initializes Store implementation.

Jump to

Keyboard shortcuts

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