upload

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

README: Commented out everything until I find a way to solve import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDTO

type CreateDTO struct {
	File io.ReadSeeker `validate:"required"`
	Name string        `validate:"required"`
	Size int           `validate:"required"`
	Type string
}

func (*CreateDTO) Ok

func (d *CreateDTO) Ok(l ut.Translator) (map[string]string, bool)

func (*CreateDTO) ToEntity

func (d *CreateDTO) ToEntity() (*Upload, []byte, error)

type CreatedEvent

type CreatedEvent struct {
	// Sender  user.User
	Session session.Session
	Data    CreateDTO
	Result  Upload
}

func NewCreatedEvent

func NewCreatedEvent(ctx context.Context, data CreateDTO, result Upload) (*CreatedEvent, error)

type DeletedEvent

type DeletedEvent struct {
	// Sender  user.User
	Session session.Session
	Result  Upload
}

func NewDeletedEvent

func NewDeletedEvent(ctx context.Context, result Upload) (*DeletedEvent, error)

type FindParams

type FindParams struct {
	Limit  int
	Offset int
	SortBy []string
	Search string
	Type   string
}

type Repository

type Repository interface {
	Count(ctx context.Context) (int64, error)
	GetAll(ctx context.Context) ([]*Upload, error)
	GetPaginated(ctx context.Context, params *FindParams) ([]*Upload, error)
	GetByID(ctx context.Context, id uint) (*Upload, error)
	GetByHash(ctx context.Context, hash string) (*Upload, error)
	Create(ctx context.Context, data *Upload) error
	Update(ctx context.Context, data *Upload) error
	Delete(ctx context.Context, id uint) error
}

type Storage

type Storage interface {
	Save(ctx context.Context, fileName string, bytes []byte) error
}

type UpdateDTO

type UpdateDTO struct {
}

func (*UpdateDTO) Ok

func (d *UpdateDTO) Ok(l ut.Translator) (map[string]string, bool)

func (*UpdateDTO) ToEntity

func (d *UpdateDTO) ToEntity(id uint) (*Upload, error)

type UpdatedEvent

type UpdatedEvent struct {
	// Sender  user.User
	Session session.Session
	Data    UpdateDTO
	Result  Upload
}

func NewUpdatedEvent

func NewUpdatedEvent(ctx context.Context, data UpdateDTO, result Upload) (*UpdatedEvent, error)

type Upload

type Upload struct {
	ID        uint
	Hash      string
	URL       string
	Name      string
	Size      int
	Mimetype  mimetype.MIME
	CreatedAt time.Time
	UpdatedAt time.Time
}

Jump to

Keyboard shortcuts

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