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 ¶
- type Category
- type ComponentConsumeLogs
- type Customer
- type ItemCost
- type JSONFloat
- type LanguageData
- type LanguageSettings
- type Material
- type MaterialEntry
- type MaterialSettings
- type Order
- type OrderItem
- type OrderItemMaterial
- type OrderQueueSettings
- type OrderSettings
- type PrinterSettings
- type Product
- type ProductEntry
- type SalesLogs
- type SalesPerDay
- type SalesPerDayOrder
- type Settings
- type SubmitOrderMeta
- type Topic
- type WebsocketClientBaseMessage
- type WebsocketOrderFinishClientMessage
- type WebsocketOrderFinishServerMessage
- type WebsocketOrderSubmitServerMessage
- type WebsocketSubscribeClientMessage
- type WebsocketTopicClientMessage
- type WebsocketTopicServerMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct {
Id string `json:"id" bson:"id"`
Name string `json:"name"`
Products []Product `json:"products"` // product ids
}
Category represents the category of products.
type ComponentConsumeLogs ¶
type ComponentConsumeLogs struct {
Id string `json:"id,omitempty" bson:"id,omitempty"`
Date time.Time `json:"date" bson:"date"`
Name string `json:"component_name" bson:"name"`
Quantity float32 `json:"quantity" bson:"quantity"`
Company string `json:"company" bson:"company"`
ItemName string `json:"item_name" bson:"item_name"`
OrderItemIndex uint `json:"order_item_index" bson:"order_item_index"`
OrderId string `json:"order_id" bson:"order_id"`
}
type ItemCost ¶
type ItemCost struct {
RecipeId string
ItemName string
Cost float64
SalePrice float64
Quantity float64
Components []struct {
ComponentName string
ComponentId string
EntryId string
Quantity float64
Cost float64
}
DownstreamCost []ItemCost
}
ItemCost represents the cost of an item, including the recipe cost, sale price, quantity, and the costs of the components.
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 ¶
MarshalJSON implements the json.Marshaler interface.
type LanguageData ¶
type LanguageData struct {
ApiVersion string `json:"api_version" bson:"api_version"`
Code string `json:"code" bson:"code"`
Language string `json:"language" bson:"language"`
Orientation string `json:"orientation" bson:"orientation"`
Pack map[string]interface{} `json:"pack" bson:"pack"`
}
LanguageData is used to store the language mentioned details, stored in the language json file.
type LanguageSettings ¶
type Material ¶
type Material struct {
Id string `json:"id,omitempty" bson:"id,omitempty"`
Name string `json:"name"`
Entries []MaterialEntry `json:"entries" bson:"entries"`
Quantity float64 `json:"quantity"`
Settings MaterialSettings `json:"settings" bson:"settings"`
Unit string `json:"unit" bson:"unit"`
}
Material represents a material with its details, including entries and settings.
type MaterialEntry ¶
type MaterialEntry struct {
Id string `json:"id,omitempty" bson:"id,omitempty"`
PurchaseQuantity float32 `json:"purchase_quantity" bson:"purchase_quantity"`
PurchasePrice float64 `json:"purchase_price" bson:"price"`
Quantity float32 `json:"quantity"`
Company string `json:"company"`
SKU string `json:"sku"`
ExpirationDate time.Time `json:"expiration_date" bson:"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"`
}
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"`
Id string `json:"id" bson:"id,omitempty"`
DisplayId string `json:"display_id" bson:"display_id"`
Items []OrderItem `json:"items" bson:"items"`
Discount float64 `json:"discount" bson:"discount"`
State string `json:"state" bson:"state"`
StartedAt time.Time `json:"started_at" bson:"started_at"`
Comment string `json:"comment" bson:"comment"`
Cost float64 `json:"cost" bson:"cost"`
SalePrice float64 `json:"sale_price" bson:"sale_price"`
Customer Customer `json:"customer" bson:"customer"`
IsPayLater bool `json:"is_pay_later" bson:"is_pay_later"`
IsPaid bool `json:"is_paid" bson:"is_paid"`
// IsAutoStart determines whether the order is automatically started when it is submitted.
IsAutoStart bool `json:"is_auto_start" bson:"is_auto_start"`
// ServiceStyle dine_in, takeaway or delivery
IsDelivery bool `json:"is_delivery" bson:"is_delivery"`
IsTakeAway bool `json:"is_take_away" bson:"is_take_away"`
IsDineIn bool `json:"is_dine_in" bson:"is_dine_in"`
CustomData map[string]string `json:"custom_data" bson:"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"`
Product Product `json:"product"`
Price float64 `json:"price" bson:"price"`
Materials []OrderItemMaterial `json:"materials" bson:"materials"`
IsConsumeFromReady bool `json:"is_consume_from_ready"`
SubItems []OrderItem `json:"sub_items" bson:"sub_items"`
Quantity float64 `json:"quantity" bson:"quantity"`
Comment string `json:"comment" bson:"comment"`
SalePrice float64 `json:"sale_price" bson:"sale_price"`
Cost float64 `json:"cost" bson:"cost"`
}
OrderItem represents an item in an order, including product details, materials, and pricing.
type OrderItemMaterial ¶
type OrderItemMaterial struct {
Material Material `json:"material"`
Entry MaterialEntry `json:"entry"`
Quantity float64 `json:"quantity" bson:"quantity"`
}
OrderItemMaterial represents the material, entry, and quantity associated with an order item.
type OrderQueueSettings ¶
type OrderQueueSettings struct {
Prefix string `json:"prefix" bson:"prefix"`
Next uint32 `json:"next" bson:"next"`
}
OrderQueueSettings represents the configuration settings for an order queue
type OrderSettings ¶
type OrderSettings struct {
Queues []OrderQueueSettings `json:"queues" bson:"queues"`
}
OrderSettings represents the configuration settings for orders
type PrinterSettings ¶
type PrinterSettings struct {
Host string `bson:"host" json:"host"`
}
type Product ¶
type Product struct {
Id string `bson:"id,omitempty" json:"id"`
Name string `bson:"name" json:"name"`
Materials []Material `bson:"materials" json:"materials"`
SubProducts []Product `bson:"sub_products" json:"sub_products"`
Entries []ProductEntry `bson:"entries" json:"entries"`
Price float64 `bson:"price" json:"price"`
ImageURL string `bson:"image_url" json:"image_url"`
Unit string `bson:"unit" json:"unit"`
Quantity float64 `bson:"quantity" json:"quantity"`
Ready float64 `bson:"ready" json:"ready"`
}
Product represents a product with its details, including materials, entries, and pricing.
type ProductEntry ¶
type ProductEntry struct {
Id string `json:"id,omitempty" bson:"id,omitempty"`
PurchaseQuantity float32 `json:"purchase_quantity" bson:"purchase_quantity"`
PurchasePrice float64 `json:"purchase_price"`
Quantity float32 `json:"quantity"`
Company string `json:"company"`
Unit string `json:"unit"`
SKU string `json:"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"`
SalePrice JSONFloat `json:"sale_price" bson:"sale_price"`
Items []ItemCost
OrderId string `json:"order_id"`
TimeConsumed time.Time `json:"time_consumed"`
Type string `json:"type"`
Date time.Time `json:"date"`
Cost JSONFloat `json:"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"`
Date string `json:"date" bson:"date"`
Orders []SalesPerDayOrder `json:"orders" bson:"orders"`
Costs float64 `json:"costs" bson:"costs"`
TotalSales float64 `json:"total_sales" bson:"total_sales"`
}
SalesPerDay aggregates sales data for a specific day, including total costs and sales.
type SalesPerDayOrder ¶
type SalesPerDayOrder struct {
Order Order `json:"order" bson:"order,inline"`
Costs []ItemCost `json:"costs" bson:"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"`
Inventory MaterialSettings `bson:"inventory" json:"inventory"`
Orders OrderSettings `bson:"orders" json:"orders"`
Language LanguageSettings `bson:"language" json:"language"`
ReceiptPrinter PrinterSettings `bson:"receipt_printer" json:"receipt_printer"`
}
Settings represents the configuration settings structure
type SubmitOrderMeta ¶
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.