models

package
v0.0.0-...-f5c995d Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinates

type Coordinates struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

Coordinates holds latitude and longitude.

type Cursor

type Cursor struct {
	DateCreated string `json:"date_created"`
	ProductId   string `json:"product_id"`
}

Cursor represents the composite cursor for pagination.

type DistanceResult

type DistanceResult struct {
	IP        string      `json:"ip"`
	City      string      `json:"city"`
	Distance  float64     `json:"distance"` // in km
	Unit      string      `json:"unit"`
	IPCoord   Coordinates `json:"ipCoord"`
	CityCoord Coordinates `json:"cityCoord"`
}

DistanceResult represents the response structure.

type ProductCategories

type ProductCategories struct {
	bun.BaseModel       `bun:"product_category,alias:pc"`
	ProductCategoryId   string `json:"product_category_id" bun:"product_category_id,pk,type:uuid,notnull"`
	ProductCategoryName string `json:"product_category_name" bun:"product_category_name,type:varchar(255),notnull"`
	Status              string `json:"status" bun:"status,type:varchar(25),notnull"`
	CreatedAt           string `json:"created_at" bun:"created_at,notnull"`
	UpdatedAt           string `json:"updated_at" bun:"updated_at,notnull"`
}

type ProductCategoriesQuery

type ProductCategoriesQuery struct {
	ProductCategoryId   string `json:"product_category_id"`
	ProductCategoryName string `json:"product_category_name"`
	Status              string `json:"status"`
	Limit               int    `json:"limit"`
	Offset              int    `json:"offset"`
}

type ProductCategoriesRequest

type ProductCategoriesRequest struct {
	ProductCategoryName string `json:"product_category_name" form:"product_category_name" binding:"required"`
	Status              string `json:"status" form:"status" binding:"required"`
}

func (*ProductCategoriesRequest) Validate

func (m *ProductCategoriesRequest) Validate() error

type ProductCategoriesResponse

type ProductCategoriesResponse struct {
	bun.BaseModel       `bun:"product_category,alias:pc"`
	ProductCategoryId   string `json:"product_category_id" bun:"product_category_id,pk"`
	ProductCategoryName string `json:"product_category_name" bun:"product_category_name"`
	Status              string `json:"status" bun:"status"`
	CreatedAt           string `json:"created_at" bun:"created_at"`
	UpdatedAt           string `json:"updated_at" bun:"updated_at"`
}

type Products

type Products struct {
	bun.BaseModel     `bun:"product,alias:p"`
	ProductId         string            `json:"product_id" bun:"product_id,pk,type:uuid,notnull"`
	ProductName       string            `json:"product_name" bun:"product_name,type:varchar(255),notnull"`
	ProductReference  string            `json:"product_reference" bun:"product_reference,type:varchar(255),notnull"`
	Status            string            `json:"status" bun:"status,type:varchar(25),notnull"`
	ProductCategoryId string            `json:"product_category_id" bun:"product_category_id,type:uuid,notnull"`
	ProductCategory   ProductCategories `json:"-" bun:"rel:belongs-to,join:product_category_id=product_category_id"`
	Price             int64             `json:"price" bun:"price,type:int,notnull"`
	StockLocation     string            `json:"stock_location" bun:"stock_location,type:varchar(100),notnull"`
	SupplierId        string            `json:"supplier_id" bun:"supplier_id,type:uuid,notnull"`
	Supplier          Suppliers         `json:"-" bun:"rel:belongs-to,join:supplier_id=supplier_id"`
	Quantity          int               `json:"quantity" bun:"quantity,type:int,notnull"`
	DateCreated       string            `json:"date_created" bun:"date_created,type:date,notnull"`
}

type ProductsPage

type ProductsPage struct {
	Products   []ProductsResponse `json:"products"`
	NextCursor *Cursor            `json:"next_cursor,omitempty"`
}

type ProductsPerCategoryStat

type ProductsPerCategoryStat struct {
	Category string  `bun:"category" json:"category"`
	Count    int64   `bun:"count" json:"count"`
	Percent  float64 `json:"percent"`
}

type ProductsPerSupplierStat

type ProductsPerSupplierStat struct {
	Supplier string  `bun:"supplier" json:"supplier"`
	Count    int64   `bun:"count" json:"count"`
	Percent  float64 `json:"percent"`
}

type ProductsQuery

type ProductsQuery struct {
	LastSeenId        string   `json:"last_seen_id"`
	CreatedAt         string   `json:"created_at"`
	ProductId         string   `json:"product_id"`
	ProductName       string   `json:"product_name"`
	ProductReference  string   `json:"product_reference"`
	Status            []string `json:"status"`
	ProductCategoryId []string `json:"product_category_id"`
	SupplierId        []string `json:"supplier_id"`
	FromDateCreated   string   `json:"from_date_created"`
	ToDateCreated     string   `json:"to_date_created"`
	FromPrice         string   `json:"from_price"`
	ToPrice           string   `json:"to_price"`
	FromQuantity      string   `json:"from_quantity"`
	ToQuantity        string   `json:"to_quantity"`
	Limit             int      `json:"limit"`
	Offset            int      `json:"offset"`
	Order             string   `json:"order"`
	Sort              string   `json:"sort"`
}

type ProductsRequest

type ProductsRequest struct {
	ProductName       string `json:"product_name" form:"product_name" binding:"required"`
	ProductReference  string `json:"product_reference" form:"product_reference" binding:"required"`
	Status            string `json:"status" form:"status" binding:"required"`
	ProductCategoryId string `json:"product_category_id" form:"product_category_id" binding:"required"`
	Price             int64  `json:"price" form:"price" binding:"required"`
	StockLocation     string `json:"stock_location" form:"stock_location" binding:"required"`
	SupplierId        string `json:"supplier_id" form:"supplier_id" binding:"required"`
	Quantity          int    `json:"quantity" form:"quantity" binding:"required"`
}

func (*ProductsRequest) Validate

func (m *ProductsRequest) Validate() error

type ProductsResponse

type ProductsResponse struct {
	bun.BaseModel     `bun:"product,alias:p"`
	ProductId         string                     `json:"product_id" bun:"product_id,pk"`
	ProductName       string                     `json:"product_name" bun:"product_name"`
	ProductReference  string                     `json:"product_reference" bun:"product_reference"`
	Status            string                     `json:"status" bun:"status"`
	ProductCategoryId string                     `json:"product_category_id" bun:"product_category_id"`
	ProductCategory   *ProductCategoriesResponse `bun:"rel:belongs-to,join:product_category_id=product_category_id"`
	Price             int64                      `json:"price" bun:"price"`
	StockLocation     string                     `json:"stock_location" bun:"stock_location"`
	SupplierId        string                     `json:"supplier_id" bun:"supplier_id"`
	Supplier          *SuppliersResponse         `bun:"rel:belongs-to,join:supplier_id=supplier_id"`
	Quantity          int                        `json:"quantity" bun:"quantity"`
	DateCreated       string                     `json:"date_created" bun:"date_created"`
}

type Suppliers

type Suppliers struct {
	bun.BaseModel `bun:"supplier,alias:sp"`
	SupplierId    string `json:"supplier_id" bun:"supplier_id,pk,type:uuid,notnull"`
	SupplierName  string `json:"supplier_name" bun:"supplier_name,type:varchar(100),notnull"`
	Status        string `json:"status" bun:"status,type:varchar(25),notnull"`
}

type SuppliersQuery

type SuppliersQuery struct {
	SupplierId   string `json:"supplier_id"`
	SupplierName string `json:"supplier_name"`
	Status       string `json:"status"`
	Limit        int    `json:"limit"`
	Offset       int    `json:"offset"`
}

type SuppliersRequest

type SuppliersRequest struct {
	SupplierName string `json:"supplier_name" form:"supplier_name" binding:"required"`
	Status       string `json:"status" form:"status" binding:"required"`
}

func (*SuppliersRequest) Validate

func (m *SuppliersRequest) Validate() error

type SuppliersResponse

type SuppliersResponse struct {
	bun.BaseModel `bun:"supplier,alias:sp"`
	SupplierId    string `json:"supplier_id" bun:"supplier_id,pk"`
	SupplierName  string `json:"supplier_name" bun:"supplier_name"`
	Status        string `json:"status" bun:"status"`
}

Jump to

Keyboard shortcuts

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