model

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default  SortBy = "" // ID
	Name     SortBy = "name"
	Price    SortBy = "price"    // Latest price
	Category SortBy = "category" // Category name

	Ascending  SortOrder = 1
	Descending SortOrder = -1

	Full History = 0
	Last History = 1
	None History = 2
)

Variables

This section is empty.

Functions

func MapQueryParamToDbField added in v1.0.5

func MapQueryParamToDbField(param SortBy) string

func ResultHistory added in v1.0.5

func ResultHistory() map[string]History

func SortOrders added in v1.0.5

func SortOrders() map[string]SortOrder

func SortableBy added in v1.0.5

func SortableBy() map[string]SortBy

Types

type History added in v1.0.5

type History int

type PriceInTime

type PriceInTime struct {
	Timestamp          primitive.DateTime `json:"timestamp" bson:"timestamp" validate:"required"`
	IsOnPromotion      bool               `json:"is-on-promotion" bson:"is-on-promotion" validate:"required"`
	Price              float64            `json:"price" bson:"price" validate:"required"`
	PricePerUnit       string             `json:"price-per-unit" bson:"price-per-unit" validate:"required"`
	RegularPrice       float64            `json:"regular-price" bson:"regular-price" validate:"required"`
	PricePerUnitNumber float64            `json:"price-per-unit-number" bson:"price-per-unit-number" validate:"required"`
	BestPrice          float64            `json:"best-price" bson:"best-price" validate:"required"`
	StockStatus        string             `json:"stock-status" bson:"stock-status" validate:"required"`
	IsNew              bool               `json:"is-new" bson:"is-new" validate:"required"`
}

type Product

type Product struct {
	Id   primitive.ObjectID `json:"id" bson:"_id" validate:"required"`
	Name string             `json:"name" bson:"name" validate:"required"`

	CategoryNames   []string `json:"category-names" bson:"category-names" validate:"required"`
	CategoryName    string   `json:"category-name" bson:"category-name" validate:"required"`
	AllergensFilter []string `json:"allergens-filter" bson:"allergens-filter" validate:"required"`

	SalesUnit           string             `json:"sales-unit" bson:"sales-unit" validate:"required"`
	Title               string             `json:"title" bson:"title" validate:"required"`
	CodeInternal        uint64             `json:"code-internal" bson:"code-internal" validate:"required"`
	CreatedAt           primitive.DateTime `json:"created-at" bson:"created-at" validate:"required"`
	ImageURL            string             `json:"image-url" bson:"image-url" validate:"required"`
	ApproxWeightProduct bool               `json:"approx-weight-product" bson:"approx-weight-product" validate:"required"`
	URL                 string             `json:"url" bson:"url" validate:"required"`
	Brand               string             `json:"brand" bson:"brand" validate:"required"`

	PriceInTime []PriceInTime `json:"price-in-time" bson:"price-in-time" validate:"required"`
}

type Products

type Products []Product

type QueryParameters added in v1.0.5

type QueryParameters struct {
	ProductId string
	Limit     int
	Offset    int
	History   History
	SortOrder SortOrder
	SortBy    SortBy
	Category  string
	Error     string
}

type SortBy added in v1.0.5

type SortBy string

type SortOrder added in v1.0.5

type SortOrder int

Jump to

Keyboard shortcuts

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