article

package
v0.0.0-...-d6f550b Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminDetailDto

type AdminDetailDto struct {
	*Entity
}

type AdminListDto

type AdminListDto struct {
	*Entity
}

type DetailDto

type DetailDto struct {
	UUID       string           `json:"uuid" bson:"_id,omitempty"`
	CategoryID string           `json:"categoryId" bson:"category_id"`
	Meta       map[Locale]*Meta `json:"meta" bson:"meta"`
}

type Entity

type Entity struct {
	UUID       string           `json:"uuid" bson:"_id,omitempty"`
	CategoryID string           `json:"categoryId" bson:"category_id" validate:"required"`
	Meta       map[Locale]*Meta `json:"meta" bson:"meta" validate:"required,dive"`
	Order      *int             `json:"order" bson:"order" validate:"required,min=0,max=100"`
	IsActive   bool             `json:"isActive" bson:"is_active" validate:"required,boolean"`
	CreatedAt  time.Time        `json:"createdAt" bson:"created_at" validate:"required"`
	UpdatedAt  time.Time        `json:"updatedAt" bson:"updated_at" validate:"required"`
}

func (*Entity) ToAdminDetail

func (e *Entity) ToAdminDetail() AdminDetailDto

func (*Entity) ToAdminList

func (e *Entity) ToAdminList() AdminListDto

func (*Entity) ToDetail

func (e *Entity) ToDetail() DetailDto

func (*Entity) ToList

func (e *Entity) ToList() ListDto

type Errors

type Errors interface {
	Failed(string) *i18np.Error
	InvalidUUID() *i18np.Error
	NotFound() *i18np.Error
}

type Factory

type Factory struct {
	Errors Errors
}

func NewFactory

func NewFactory() Factory

func (Factory) IsZero

func (f Factory) IsZero() bool

func (Factory) New

func (f Factory) New(cnf NewConfig) *Entity

type FilterEntity

type FilterEntity struct {
	Locale string `query:"-"`
	Query  string `query:"q,omitempty" validate:"omitempty,max=100"`
}

type ListDto

type ListDto struct {
	UUID       string           `json:"uuid" bson:"_id,omitempty"`
	CategoryID string           `json:"categoryId" bson:"category_id"`
	Meta       map[Locale]*Meta `json:"meta" bson:"meta"`
	Order      *int             `json:"order" bson:"order"`
}

type Locale

type Locale string
const (
	LocaleEN Locale = "en"
	LocaleTR Locale = "tr"
)

func (Locale) String

func (l Locale) String() string

type Meta

type Meta struct {
	Title    string `json:"title" bson:"title" validate:"required,max=100"`
	Slug     string `json:"slug" bson:"slug" validate:"omitempty"`
	Keywords string `json:"keywords" bson:"keywords" validate:"required,max=100"`
}

type NewConfig

type NewConfig struct {
	TrMeta     *Meta
	EnMeta     *Meta
	CategoryID string
}

type Repo

type Repo interface {
	Create(ctx context.Context, entity *Entity) (*Entity, *i18np.Error)
	Update(ctx context.Context, entity *Entity) *i18np.Error
	GetByID(ctx context.Context, id string) (*Entity, bool, *i18np.Error)
	GetBySlug(ctx context.Context, locale string, slug string) (*Entity, bool, *i18np.Error)
	Activate(ctx context.Context, id string) *i18np.Error
	Deactivate(ctx context.Context, id string) *i18np.Error
	ReOrder(ctx context.Context, id string, order int) *i18np.Error
	Filter(ctx context.Context, filter FilterEntity) ([]*Entity, *i18np.Error)
	FilterAdmin(ctx context.Context, filter FilterEntity) ([]*Entity, *i18np.Error)
}

func NewRepo

func NewRepo(collection *mongo.Collection, factory Factory) Repo

Jump to

Keyboard shortcuts

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