models

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package models contains the data models for the application.

The models are used to store data in the database and to marshal/unmarshal data to/from JSON.

The models are divided into the following categories:

- Sales: Models related to sales, such as SalesPerDay and SalesPerDayOrder.

- Items: Models related to items, such as ItemCost and OrderItem.

- Orders: Models related to orders, such as Order and OrderItem.

- Materials: Models related to materials, such as Material and MaterialEntry.

- Products: Models related to products, such as Product and ProductEntry.

- SalesLogs: Models related to sales logs, such as SalesLogs.

Package models contains the data models for the application.

The models are used to store data in the database and to marshal/unmarshal data to/from JSON.

Index

Constants

View Source
const (
	TypeDisposalMaterial = "disposal_material"
	TypeDisposalProduct  = "disposal_product"
)
View Source
const (
	LogTypeDisposalAdd             = "disposal_add"
	LogTypeMaterialInventoryReturn = "material_inventory_return"
	LogTypeOrderItemRefunded       = "order_item_refunded"
	LogTypeOrderStart              = "order_Start"
	LogTypeOrderFinish             = "order_finish"
	LogTypeMaterialConsume         = "component_consume"
	LogTypeMaterialAdd             = "component_add"
	LogTypeMaterialWaste           = "material_waste"
	LogTypeProductIncrease         = "product_increase"
	LogTypeSalesPerDayOrder        = "sales_per_day_order"
	LogTypeSalesPerDayRefund       = "sales_per_day_refund"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Id       string    `json:"id" bson:"id" mapstructure:"id"`
	Name     string    `json:"name" mapstructure:"name"`
	Products []Product `json:"products" mapstructure:"products"` // product ids
}

Category represents the category of products.

type ComponentConsumeLogs

type ComponentConsumeLogs struct {
	Id             string    `json:"id,omitempty" bson:"id,omitempty" mapstructure:"id,omitempty"`
	Date           time.Time `json:"date" bson:"date" mapstructure:"date"`
	Name           string    `json:"component_name" bson:"name" mapstructure:"component_name"`
	Quantity       float32   `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Company        string    `json:"company" bson:"company" mapstructure:"company"`
	ItemName       string    `json:"item_name" bson:"item_name" mapstructure:"item_name"`
	OrderItemIndex uint      `json:"order_item_index" bson:"order_item_index" mapstructure:"order_item_index"`
	OrderId        string    `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	Type           string    `json:"type" bson:"type" mapstructure:"type"`
}

type Customer

type Customer struct {
	Id      string `json:"id" bson:"id" mapstructure:"id"`
	Name    string `json:"name" bson:"name" mapstructure:"name"`
	Phone   string `json:"phone" bson:"phone" mapstructure:"phone"`
	Address string `json:"address" bson:"address" mapstructure:"address"`
}

type Disposal added in v0.0.14

type Disposal struct {
	Id       string  `json:"id" bson:"id" mapstructure:"id"`
	OrderId  string  `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	Type     string  `json:"type" bson:"type" mapstructure:"type"` // material or order_item
	Quantity float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Comment  string  `json:"comment" bson:"comment" mapstructure:"comment"`
}

Disposal used to store a returned order item or material which is too unique and modified to return to normal inventory state

type ItemCost

type ItemCost struct {
	ProductId  string  `json:"product_id" bson:"product_id" mapstructure:"product_id"`
	ItemId     string  `json:"item_id" bson:"item_id" mapstructure:"item_id"`
	ItemName   string  `json:"item_name" bson:"item_name" mapstructure:"item_name"`
	Cost       float64 `json:"cost" bson:"cost" mapstructure:"cost"`
	SalePrice  float64 `json:"sale_price" bson:"sale_price" mapstructure:"sale_price"`
	Quantity   float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Components []struct {
		ComponentName string  `json:"component_name" bson:"component_name" mapstructure:"component_name"`
		ComponentId   string  `json:"component_id" bson:"component_id" mapstructure:"component_id"`
		EntryId       string  `json:"entry_id" bson:"entry_id" mapstructure:"entry_id"`
		Quantity      float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
		Cost          float64 `json:"cost" bson:"cost" mapstructure:"cost"`
	} `json:"components" bson:"components" mapstructure:"components"`

	DownstreamCost []ItemCost `json:"downstream_cost" bson:"downstream_cost" mapstructure:"downstream_cost"`
}

ItemCost represents the cost of an item, including the recipe cost, sale price, quantity, and the costs of the components.

type ItemRefund added in v0.0.20

type ItemRefund struct {
	Id              string                      `json:"id" bson:"id" mapstructure:"id"`
	OrderId         string                      `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	ItemId          string                      `json:"order_item_id" bson:"order_item_id" mapstructure:"order_item_id"`
	ProductId       string                      `json:"product_id" bson:"product_id" mapstructure:"product_id"`
	Reason          string                      `json:"reason" bons:"reason" mapstructure:"reason"`
	Amount          float64                     `json:"amount" bson:"amount" mapstructure:"amount"`
	ItemCost        float64                     `json:"item_cost" bson:"item_cost" mapstructure:"item_cost"`
	Destination     string                      `json:"destination" bson:"destination" mapstructure:"destination"`
	MaterialRerunds []OrderItemRefundMaterial   `json:"material_refunds" bson:"material_refunds" mapstructure:"material_refunds"`
	ProductAdd      []OrderItemRefundProductAdd `json:"products_add" bson:"products_add" mapstructure:"products_add"`
}

type JSONFloat

type JSONFloat float64

JSONFloat is a float64 that is marshaled to JSON as a string to avoid the JSON number type limitations.

func (JSONFloat) MarshalJSON

func (j JSONFloat) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

type LanguageData

type LanguageData struct {
	ApiVersion  string                 `json:"api_version" bson:"api_version" mapstructure:"api_version"`
	Code        string                 `json:"code" bson:"code" mapstructure:"code"`
	Language    string                 `json:"language" bson:"language" mapstructure:"language"`
	Orientation string                 `json:"orientation" bson:"orientation" mapstructure:"orientation"`
	Pack        map[string]interface{} `json:"pack" bson:"pack" mapstructure:"pack"`
}

LanguageData is used to store the language mentioned details, stored in the language json file.

type LanguageSettings

type LanguageSettings struct {
	Code     string `json:"code" bson:"code" mapstructure:"code"`
	Language string `json:"language" bson:"language" mapstructure:"language"`
}

type Log added in v0.0.14

type Log struct {
	Id     string    `json:"id" bson:"id" mapstructure:"id"`
	Type   string    `json:"type" bson:"type" mapstructure:"type"` // the log action type
	Date   time.Time `json:"date" bson:"date" mapstructure:"date"`
	UserId string    `json:"user_id" bson:"user_id" mapstructure:"user_id"`
}

type LogDisposalMaterialAdd added in v0.0.16

type LogDisposalMaterialAdd struct {
	Log      `json:",inline" bson:",inline" mapstructure:",squash"`
	Disposal MaterialDisposal `json:"disposal" mapstructure:"disposal"`
}

type LogDisposalProductAdd added in v0.0.16

type LogDisposalProductAdd struct {
	Log      `json:",inline" bson:",inline" mapstructure:",squash"`
	Disposal ProductDisposal `json:"disposal" mapstructure:"disposal"`
}

type LogMaterialAdd added in v0.0.16

type LogMaterialAdd struct {
	Log        `json:",inline" bson:",inline" mapstructure:",squash"`
	MaterialId string  `json:"material_id" bson:"material_id" mapstructure:"material_id"`
	EntryId    string  `json:"entry_id" bson:"entry_id" mapstructure:"entry_id"`
	Quantity   float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
}

type LogMaterialConsume added in v0.0.16

type LogMaterialConsume struct {
	Log            `json:",inline" bson:",inline" mapstructure:",squash"`
	MaterialId     string  `json:"material_id" bson:"material_id" mapstructure:"material_id"`
	EntryId        string  `json:"entry_id" bson:"entry_id" mapstructure:"entry_id"`
	OrderId        string  `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	ProductId      string  `json:"recipe_id" bson:"recipe_id" mapstructure:"recipe_id"`
	OrderItemIndex int     `json:"order_item_index" bson:"order_item_index" mapstructure:"order_item_index"`
	Reason         string  `json:"reason" bson:"reason" mapstructure:"reason"`
	Quantity       float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
}

type LogMaterialInventoryReturn added in v0.0.16

type LogMaterialInventoryReturn struct {
	Log      `json:",inline" bson:",inline" mapstructure:",squash"`
	OrderId  string  `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	Quantity float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Reason   string  `json:"reason" bson:"reason" mapstructure:"reason"`
}

type LogOrderFinish added in v0.0.16

type LogOrderFinish struct {
	Log          `json:",inline" bson:",inline" mapstructure:",squash"`
	Cost         float64       `json:"cost" bson:"cost" mapstructure:"cost"`
	SalePrice    float64       `json:"sale_price" bson:"sale_price" mapstructure:"sale_price"`
	Items        []ItemCost    `json:"items" bson:"items" mapstructure:"items"`
	OrderId      string        `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	TimeConsumed time.Duration `json:"time_consumed" bson:"time_consumed" mapstructure:"time_consumed"`
}

type LogOrderItemRefund added in v0.0.16

type LogOrderItemRefund struct {
	Id              string `json:"id" bson:"id" mapstructure:"id"`
	Log             `json:",inline" bson:",inline" mapstructure:",squash"`
	OrderId         string                      `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	ItemId          string                      `json:"order_item_id" bson:"order_item_id" mapstructure:"order_item_id"`
	ProductId       string                      `json:"product_id" bson:"product_id" mapstructure:"product_id"`
	Reason          string                      `json:"reason" bons:"reason" mapstructure:"reason"`
	Amount          float64                     `json:"amount" bson:"amount" mapstructure:"amount"`
	ItemCost        float64                     `json:"item_cost" bson:"item_cost" mapstructure:"item_cost"`
	Destination     string                      `json:"destination" bson:"destination" mapstructure:"destination"`
	MaterialRerunds []OrderItemRefundMaterial   `json:"material_refunds" bson:"material_refunds" mapstructure:"material_refunds"`
	ProductAdd      []OrderItemRefundProductAdd `json:"products_add" bson:"products_add" mapstructure:"products_add"`
}

type LogOrderStart added in v0.0.16

type LogOrderStart struct {
	Log          `json:",inline" bson:",inline" mapstructure:",squash"`
	OrderDetails Order `json:"order_details" bson:"order_details" mapstructure:"order_details"`
}

type LogProductIncrease added in v0.0.16

type LogProductIncrease struct {
	Log       `json:",inline" bson:",inline" mapstructure:",squash"`
	ProductId string  `json:"product_id" bson:"product_id" mapstructure:"product_id"`
	Quantity  float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Source    string  `json:"source" bson:"source" mapstructure:"source"`
	OrderId   string  `json:"order_id" bson:"order_id" mapstructure:"order_id"`
}

type LogProductWaste added in v0.0.16

type LogProductWaste struct {
	Log         `json:",inline" bson:",inline" mapstructure:",squash"`
	ProductId   string    `json:"product_id" bson:"product_id" mapstructure:"product_id"`
	OrderId     string    `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	OrderItemId string    `json:"order_item_id" bson:"order_item_id" mapstructure:"order_item_id"`
	Reason      string    `json:"reason" bson:"reason" mapstructure:"reason"`
	Quantity    float64   `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Item        OrderItem `json:"item" bson:"item" mapstructure:"item"`
}

type LogRefundOrder added in v0.0.16

type LogRefundOrder struct {
	Log     `json:",inline" bson:",inline" mapstructure:",squash"`
	Reason  string `json:"reason" bson:"reason" mapstructure:"reason"`
	OrderId string `json:"order_id" bson:"order_id" mapstructure:"order_id"`
}

type LogSalesPerDayOrder added in v0.0.16

type LogSalesPerDayOrder struct {
	Log              `json:",inline" bson:",inline" mapstructure:",squash"`
	SalesPerDayOrder SalesPerDayOrder `json:"sales_per_day_order" bson:"sales_per_day_order" mapstructure:"sales_per_day_order"`
}

type LogWasteMaterial added in v0.0.16

type LogWasteMaterial struct {
	Log        `json:",inline" bson:",inline" mapstructure:",squash"`
	MaterialId string  `json:"material_id" bson:"material_id" mapstructure:"material_id"`
	EntryId    string  `json:"entry_id" bson:"entry_id" mapstructure:"entry_id"`
	OrderId    string  `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	Reason     string  `json:"reason" bson:"reason" mapstructure:"reason"`
	IsConsume  bool    `json:"is_consume" bson:"is_consume" mapstructure:"is_consume"`
	Quantity   float64 `json:"quantity" bson:"quantity" mapstructure:"quantity"`
}

type LogWasteOrderItem added in v0.0.16

type LogWasteOrderItem struct {
	Log      `json:",inline" bson:",inline" mapstructure:",squash"`
	Item     OrderItem `json:"item" bson:"item" mapstructure:"item"`
	OrderId  string    `json:"order_id" bson:"order_id" mapstructure:"order_id"`
	Quantity float64   `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Reason   string    `json:"reason" bson:"reason" mapstructure:"reason"`
}

type Material

type Material struct {
	Id       string           `json:"id,omitempty" bson:"id,omitempty" mapstructure:"id,omitempty"`
	Name     string           `json:"name" mapstructure:"name"`
	Entries  []MaterialEntry  `json:"entries" bson:"entries" mapstructure:"entries"`
	Quantity float64          `json:"quantity" mapstructure:"quantity"`
	Settings MaterialSettings `json:"settings" bson:"settings" mapstructure:"settings"`
	Unit     string           `json:"unit" bson:"unit" mapstructure:"unit"`
}

Material represents a material with its details, including entries and settings.

type MaterialDisposal added in v0.0.14

type MaterialDisposal struct {
	Disposal   `json:",inline" mapstructure:",squash"`
	MaterialId string `json:"material_id" bson:"material_id" mapstructure:"material_id"`
	EntryId    string `json:"entry_id" bson:"entry_id" mapstructure:"entry_id"`
}

type MaterialEntry

type MaterialEntry struct {
	Id               string    `json:"id,omitempty" bson:"id,omitempty" mapstructure:"id,omitempty"`
	PurchaseQuantity float64   `json:"purchase_quantity" bson:"purchase_quantity" mapstructure:"purchase_quantity"`
	PurchasePrice    float64   `json:"purchase_price" bson:"price" mapstructure:"purchase_price"`
	Quantity         float64   `json:"quantity" mapstructure:"quantity"`
	Company          string    `json:"company" mapstructure:"company"`
	SKU              string    `json:"sku" mapstructure:"sku"`
	ExpirationDate   time.Time `json:"expiration_date" bson:"expiration_date" mapstructure:"expiration_date"`
}

MaterialEntry represents an entry of material, detailing purchase and quantity information.

type MaterialSettings

type MaterialSettings struct {
	StockAlertTreshold float64 `json:"stock_alert_treshold" bson:"stock_alert_treshold" mapstructure:"stock_alert_treshold"`
}

MaterialSettings represents settings associated with a material, such as stock alert threshold.

type Order

type Order struct {
	SubmittedAt time.Time   `json:"submitted_at" bson:"submitted_at" mapstructure:"submitted_at"`
	Id          string      `json:"id" bson:"id,omitempty" mapstructure:"id,omitempty"`
	DisplayId   string      `json:"display_id" bson:"display_id" mapstructure:"display_id"`
	Items       []OrderItem `json:"items" bson:"items" mapstructure:"items"`
	Discount    float64     `json:"discount" bson:"discount" mapstructure:"discount"`
	State       string      `json:"state" bson:"state" mapstructure:"state"`
	StartedAt   time.Time   `json:"started_at" bson:"started_at" mapstructure:"started_at"`
	Comment     string      `json:"comment" bson:"comment" mapstructure:"comment"`
	Cost        float64     `json:"cost" bson:"cost" mapstructure:"cost"`
	SalePrice   float64     `json:"sale_price" bson:"sale_price" mapstructure:"sale_price"`
	Customer    Customer    `json:"customer" bson:"customer" mapstructure:"customer"`
	IsPayLater  bool        `json:"is_pay_later" bson:"is_pay_later" mapstructure:"is_pay_later"`
	IsPaid      bool        `json:"is_paid" bson:"is_paid" mapstructure:"is_paid"`
	// IsAutoStart determines whether the order is automatically started when it is submitted.
	IsAutoStart  bool `json:"is_auto_start" bson:"is_auto_start" mapstructure:"is_auto_start"`
	IsAutoFinish bool `json:"is_auto_finish" bson:"is_auto_finish" mapstructure:"is_auto_finish"`
	// ServiceStyle  dine_in, takeaway or delivery
	IsDelivery bool              `json:"is_delivery" bson:"is_delivery" mapstructure:"is_delivery"`
	IsTakeAway bool              `json:"is_take_away" bson:"is_take_away" mapstructure:"is_take_away"`
	IsDineIn   bool              `json:"is_dine_in" bson:"is_dine_in" mapstructure:"is_dine_in"`
	CustomData map[string]string `json:"custom_data" bson:"custom_data" mapstructure:"custom_data"`
}

Order represents a customer order, containing order details, items, and financial information.

type OrderItem

type OrderItem struct {
	Id                 string              `json:"id" bson:"id" mapstructure:"id"`
	Product            Product             `json:"product" mapstructure:"product"`
	Price              float64             `json:"price" bson:"price" mapstructure:"price"`
	Materials          []OrderItemMaterial `json:"materials" bson:"materials" mapstructure:"materials"`
	IsConsumeFromReady bool                `json:"is_consume_from_ready" mapstructure:"is_consume_from_ready"`
	SubItems           []OrderItem         `json:"sub_items" bson:"sub_items" mapstructure:"sub_items"`
	Quantity           float64             `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	Comment            string              `json:"comment" bson:"comment" mapstructure:"comment"`
	SalePrice          float64             `json:"sale_price" bson:"sale_price" mapstructure:"sale_price"`
	Cost               float64             `json:"cost" bson:"cost" mapstructure:"cost"`
	Status             string              `json:"status" bson:"status" mapstructure:"status"`
}

OrderItem represents an item in an order, including product details, materials, and pricing.

type OrderItemMaterial

type OrderItemMaterial struct {
	Material     Material      `json:"material" mapstructure:"material"`
	Entry        MaterialEntry `json:"entry" mapstructure:"entry"`
	Quantity     float64       `json:"quantity" bson:"quantity" mapstructure:"quantity"`
	IsRefunded   bool          `json:"is_refunded" bson:"is_refunded" mapstructure:"is_refunded"`
	RefundReason string        `json:"refund_reason" bson:"refund_reason" mapstructure:"refund_reason"`
}

OrderItemMaterial represents the material, entry, and quantity associated with an order item.

type OrderItemRefundMaterial added in v0.0.14

type OrderItemRefundMaterial struct {
	MaterialId         string  `json:"material_id" bson:"material_id" mapstructure:"material_id"`
	EntryId            string  `json:"entry_id" bson:"entry_id" mapstructure:"entry_id"`
	InventoryReturnQty float64 `json:"inventory_return_qty" bson:"inventory_return_qty" mapstructure:"inventory_return_qty"`
	DisposeQty         float64 `json:"dispose_qty" bson:"dispose_qty" mapstructure:"dispose_qty"`
	WasteQty           float64 `json:"waste_qty" bson:"waste_qty" mapstructure:"waste_qty"`
	CostPerUnit        float64 `json:"cost_per_unit" bson:"cost_per_unit" mapstructure:"cost_per_unit"`
	Comment            string  `json:"comment" bson:"comment" mapstructure:"comment"`
}

type OrderItemRefundProductAdd added in v0.0.14

type OrderItemRefundProductAdd struct {
	ProductId string  `json:"product_id" mapstructure:"product_id"`
	Quantity  float64 `json:"quantity" mapstructure:"quantity"`
	Comment   string  `json:"comment" bson:"comment" mapstructure:"comment"`
}

type OrderQueueSettings

type OrderQueueSettings struct {
	Prefix string `json:"prefix" bson:"prefix" mapstructure:"prefix"`
	Next   uint32 `json:"next" bson:"next" mapstructure:"next"`
}

OrderQueueSettings represents the configuration settings for an order queue

type OrderSettings

type OrderSettings struct {
	Queues []OrderQueueSettings `json:"queues" bson:"queues" mapstructure:"queues"`
}

OrderSettings represents the configuration settings for orders

type PrinterSettings

type PrinterSettings struct {
	Host string `bson:"host" json:"host" mapstructure:"host"`
}

type Product

type Product struct {
	Id                         string         `bson:"id,omitempty" json:"id" mapstructure:"id,omitempty"`
	Name                       string         `bson:"name" json:"name" mapstructure:"name"`
	Materials                  []Material     `bson:"materials" json:"materials" mapstructure:"materials"`
	SubProducts                []Product      `bson:"sub_products" json:"sub_products" mapstructure:"sub_products"`
	Entries                    []ProductEntry `bson:"entries" json:"entries" mapstructure:"entries"`
	Price                      float64        `bson:"price" json:"price" mapstructure:"price"`
	ImageURL                   string         `bson:"image_url" json:"image_url" mapstructure:"image_url"`
	Unit                       string         `bson:"unit" json:"unit" mapstructure:"unit"`
	Quantity                   float64        `bson:"quantity" json:"quantity" mapstructure:"quantity"`
	Ready                      float64        `bson:"ready" json:"ready" mapstructure:"ready"`
	EnableInventoryConsumption bool           `bson:"enable_inventory_consumption" json:"enable_inventory_consumption" mapstructure:"enable_inventory_consumption"`
}

Product represents a product with its details, including materials, entries, and pricing.

type ProductDisposal added in v0.0.14

type ProductDisposal struct {
	Disposal `json:",inline" mapstructure:",squash"`
	Item     OrderItem `json:"item" bson:"item" mapstructure:"item"`
}

type ProductEntry

type ProductEntry struct {
	Id               string  `json:"id,omitempty" bson:"id,omitempty" mapstructure:"id,omitempty"`
	PurchaseQuantity float64 `json:"purchase_quantity" bson:"purchase_quantity" mapstructure:"purchase_quantity"`
	PurchasePrice    float64 `json:"purchase_price" mapstructure:"purchase_price"`
	Quantity         float64 `json:"quantity" mapstructure:"quantity"`
	Company          string  `json:"company" mapstructure:"company"`
	Unit             string  `json:"unit" mapstructure:"unit"`
	SKU              string  `json:"sku" mapstructure:"sku"`
}

ProductEntry represents an entry of a product, detailing purchase and quantity information.

type SalesLogs

type SalesLogs struct {
	Id           string     `json:"id" bson:"id,omitempty" mapstructure:"id,omitempty"`
	SalePrice    JSONFloat  `json:"sale_price" bson:"sale_price" mapstructure:"sale_price"`
	Items        []ItemCost `mapstructure:"items"`
	OrderId      string     `json:"order_id" mapstructure:"order_id"`
	TimeConsumed time.Time  `json:"time_consumed" mapstructure:"time_consumed"`
	Type         string     `json:"type" mapstructure:"type"`
	Date         time.Time  `json:"date" mapstructure:"date"`
	Cost         JSONFloat  `json:"cost" mapstructure:"cost"`
}

SalesLogs represents logs of sales, capturing sale price, items, and consumption details.

type SalesPerDay

type SalesPerDay struct {
	Id           string             `json:"id" bson:"id,omitempty" mapstructure:"id"`
	Date         string             `json:"date" bson:"date" mapstructure:"date"`
	Orders       []SalesPerDayOrder `json:"orders" bson:"orders" mapstructure:"orders"`
	Refunds      []ItemRefund       `json:"refunds" bson:"refunds" mapstructure:"refunds"`
	Costs        float64            `json:"costs" bson:"costs" mapstructure:"costs"`
	TotalSales   float64            `json:"total_sales" bson:"total_sales" mapstructure:"total_sales"`
	RefundsValue float64            `json:"refunds_value" bson:"refunds_value" mapstructure:"refunds_value"`
}

SalesPerDay aggregates sales data for a specific day, including total costs and sales.

type SalesPerDayOrder

type SalesPerDayOrder struct {
	Id    string     `json:"id" bson:"id" mapstructure:"id"`
	Order Order      `json:"order" bson:"order,inline" mapstructure:"order"`
	Costs []ItemCost `json:"costs" bson:"costs" mapstructure:"costs"`
}

SalesPerDayOrder represents an order and its associated costs for a specific day.

type Settings

type Settings struct {
	Id             string           `bson:"id,omitempty" json:"id" mapstructure:"id"`
	Inventory      MaterialSettings `bson:"inventory" json:"inventory" mapstructure:"inventory"`
	Orders         OrderSettings    `bson:"orders" json:"orders" mapstructure:"orders"`
	Language       LanguageSettings `bson:"language" json:"language" mapstructure:"language"`
	ReceiptPrinter PrinterSettings  `bson:"receipt_printer" json:"receipt_printer" mapstructure:"receipt_printer"`
}

Settings represents the configuration settings structure

type SubmitOrderMeta

type SubmitOrderMeta struct {
	IsPrintClientReceipt  bool `json:"is_print_client_receipt" bson:"is_print_client_receipt" mapstructure:"is_print_client_receipt"`
	IsPrintKitchenReceipt bool `json:"is_print_kitchen_receipt" bson:"is_print_kitchen_receipt" mapstructure:"is_print_kitchen_receipt"`
}

type Topic

type Topic struct {
	Name        string
	Subscribers []string
}

Topic represents a group of subscribers for a specific topic.

type WebsocketClientBaseMessage

type WebsocketClientBaseMessage struct {
	Type string `json:"type"`
}

WebsocketClientBaseMessage is a base message for all client messages.

type WebsocketOrderFinishClientMessage

type WebsocketOrderFinishClientMessage struct {
	OrderId string `json:"order_id"`
}

WebsocketOrderFinishClientMessage is a message sent by the client to finish an order.

type WebsocketOrderFinishServerMessage

type WebsocketOrderFinishServerMessage struct {
	WebsocketTopicServerMessage `json:",inline"`
	OrderId                     string `json:"order_id"`
}

WebsocketOrderFinishServerMessage is a message sent by the server to finish an order.

type WebsocketOrderSubmitServerMessage

type WebsocketOrderSubmitServerMessage struct {
	WebsocketTopicServerMessage `json:",inline"`
	Order                       Order `json:"order"`
}

type WebsocketSubscribeClientMessage

type WebsocketSubscribeClientMessage struct {
	WebsocketClientBaseMessage `json:",inline"`
	TopicName                  string `json:"topic_name"`
}

WebsocketSubscribeClientMessage is a message sent by the client to subscribe to a specific topic.

type WebsocketTopicClientMessage

type WebsocketTopicClientMessage struct {
	TopicName string `json:"topic_name"`
}

WebsocketTopicClientMessage is a message sent by the client to send a message to a specific topic.

type WebsocketTopicServerMessage

type WebsocketTopicServerMessage struct {
	Type      string    `json:"type"`
	Date      time.Time `json:"date"`
	TopicName string    `json:"topic_name"`
	Severity  string    `json:"severity"`
	Message   string    `json:"message"`
	Key       string    `json:"key"` // unqique label to prevent message duplications
}

WebsocketTopicServerMessage is a message sent by the server to a specific topic.

Jump to

Keyboard shortcuts

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