position

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDTO

type CreateDTO struct {
	Title    string `validate:"required"`
	Barcode  string `validate:"required"`
	UnitID   uint   `validate:"required"`
	ImageIDs []uint
}

func (*CreateDTO) Ok

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

func (*CreateDTO) ToEntity

func (d *CreateDTO) ToEntity() (*Position, error)

type CreatedEvent

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

func NewCreatedEvent

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

type DeletedEvent

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

func NewDeletedEvent

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

type FindParams

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

type Position

type Position struct {
	ID        uint
	Title     string
	Barcode   string
	UnitID    uint
	Unit      unit.Unit
	Images    []upload.Upload
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Repository

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

type UpdateDTO

type UpdateDTO struct {
	Title   string
	Barcode string
	UnitID  uint
}

func (*UpdateDTO) Ok

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

func (*UpdateDTO) ToEntity

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

type UpdatedEvent

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

func NewUpdatedEvent

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

Jump to

Keyboard shortcuts

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