models

package
v0.0.0-...-ff7f6f1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignCourier

type AssignCourier struct {
	CourierId uint           `json:"courier_id"`
	Orders    []AssignOrders `json:"orders"`
}

type AssignCouriers

type AssignCouriers struct {
	Date     time.Time       `json:"date"`
	Couriers []AssignCourier `json:"orders"`
}

type AssignOrders

type AssignOrders struct {
	GroupOrderId uint            `json:"group_order_id"`
	Orders       []ResponseOrder `json:"orders"`
}

type CompleteOrder

type CompleteOrder struct {
	ID            uint      `json:"order_id,omitempty"`
	CompletedTime time.Time `json:"completed_time,omitempty"`
	CourierID     uint      `json:"courier_id,omitempty"`
}

type CompleteOrders

type CompleteOrders struct {
	Orders []CompleteOrder `json:"complete_info"`
}

type Courier

type Courier struct {
	gorm.Model

	TypeID *string `json:"courier_type,omitempty"`
	Type   *Type   `json:"courier_type_full,omitempty"`

	Regions      pq.Int64Array  `json:"regions" gorm:"type:integer[]"`
	WorkingHours pq.StringArray `json:"working_hours" gorm:"type:text[]"`
}

type Courier1

type Courier1 struct {
	CourierType CourierType
	MaxWeight   float32
	MaxOrders   int
	Regions     []int
	Orders      []Order
	TotalWeight float32
	TotalCost   float32
	TotalTime   float32
}

func (*Courier1) CanTakeOrder

func (c *Courier1) CanTakeOrder(order Order) bool

func (*Courier1) CheckRegion

func (c *Courier1) CheckRegion(order Order) bool

func (*Courier1) CheckWeight

func (c *Courier1) CheckWeight(order Order) bool

func (*Courier1) TakeOrder

func (c *Courier1) TakeOrder(order Order)

type CourierType

type CourierType string
const (
	Foot CourierType = "Foot"
	Bike CourierType = "Bike"
	Car  CourierType = "Car"
)

type Couriers

type Couriers struct {
	Couriers []Courier `json:"couriers"`
}

type Order

type Order struct {
	gorm.Model
	Name string `json:"name" gorm:"uniqueIndex"`
	Cost int    `json:"cost"`
	//RegionID *uint   `json:"region_id,omitempty"`
	//Region   *Region `json:"regions" gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Weight float32 `json:"weight"`

	DeliveryHours pq.StringArray `json:"delivery_hours" gorm:"type:text[]"`
	Regions       int            `json:"regions"`

	CompletedTime time.Time `json:"completed_time,omitempty"`

	CourierID *uint    `json:"courier_id,omitempty"`
	Courier   *Courier `json:"courier,omitempty"`
}

type Order1

type Order1 struct {
	Weight int
	Region int
	Cost   float64
}

type Orders

type Orders struct {
	Orders []Order `json:"orders"`
}

type OrdersByCost

type OrdersByCost []Order

func (OrdersByCost) Len

func (o OrdersByCost) Len() int

func (OrdersByCost) Less

func (o OrdersByCost) Less(i, j int) bool

func (OrdersByCost) Swap

func (o OrdersByCost) Swap(i, j int)

type Response

type Response struct {
	Code    int         `json:"code,omitempty"`
	Body    interface{} `json:"body,omitempty"`
	Title   string      `json:"title,omitempty"`
	Message string      `json:"message,omitempty"`
}

type Response1

type Response1 struct {
	Code    int         `json:"code,omitempty"`
	Body    interface{} `json:"body,omitempty"`
	Title   string      `json:"title,omitempty"`
	Message string      `json:"message,omitempty"`
	Hours   float64     `json:"hours,omitempty"`
	Sum     uint        `json:"sum,omitempty"`
}

type ResponseCourier

type ResponseCourier struct {
	CourierId    uint     `json:"courier_id"`
	CourierType  string   `json:"courier_type"`
	Regions      []int    `json:"regions"`
	WorkingHours []string `json:"working_hours,omitempty"`
}

type ResponseCouriers

type ResponseCouriers struct {
	Couriers []ResponseCourier `json:"couriers"`
	Limit    int               `json:"limit,omitempty"`
	Offset   int               `json:"offset,omitempty"`
}

type ResponseMetaInfo

type ResponseMetaInfo struct {
	ResponseCourier
	Rating   int `json:"rating"`
	Earnings int `json:"earnings"`
}

type ResponseOrder

type ResponseOrder struct {
	Cost          int       `json:"cost"`
	DeliveryHours []string  `json:"delivery_hours"`
	OrderID       uint      `json:"order_id"`
	Regions       int       `json:"regions"`
	Weight        float32   `json:"weight"`
	CompletedTime time.Time `json:"completed_time,omitempty"`
}

type Type

type Type struct {
	ID          string `json:"id" gorm:"primaryKey"`
	Ratio       int
	RatingRatio int
	MaxWeight   float32
	MaxOrders   int
	MaxRegions  int
}

Jump to

Keyboard shortcuts

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