Self Order - Feature
This commit is contained in:
@@ -1,51 +1,54 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type CreateSelfOrderRequest struct {
|
||||
CustomerName string `json:"customer_name" validate:"required,min=1,max=255"`
|
||||
PhoneNumber *string `json:"phone_number,omitempty" validate:"omitempty"`
|
||||
OrderItems []SelfOrderItemRequest `json:"order_items" validate:"required,min=1,dive"`
|
||||
Notes *string `json:"notes,omitempty" validate:"omitempty,max=1000"`
|
||||
}
|
||||
|
||||
type SelfOrderItemRequest struct {
|
||||
ProductID uuid.UUID `json:"product_id" validate:"required"`
|
||||
ProductVariantID *uuid.UUID `json:"product_variant_id,omitempty"`
|
||||
Quantity int `json:"quantity" validate:"required,min=1"`
|
||||
Notes *string `json:"notes,omitempty" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
type SelfOrderResponse struct {
|
||||
OrderID uuid.UUID `json:"order_id"`
|
||||
OrderNumber string `json:"order_number"`
|
||||
TableID uuid.UUID `json:"table_id"`
|
||||
TableName string `json:"table_name"`
|
||||
OutletID uuid.UUID `json:"outlet_id"`
|
||||
OutletName string `json:"outlet_name"`
|
||||
CustomerName string `json:"customer_name"`
|
||||
OrderItems []OrderItemResponse `json:"order_items"`
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
TaxAmount float64 `json:"tax_amount"`
|
||||
TotalAmount float64 `json:"total_amount"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
type SelfOrderMenuRequest struct {
|
||||
TableID uuid.UUID `json:"table_id" validate:"required"`
|
||||
CustomerName string `json:"customer_name" validate:"required"`
|
||||
Phone *string `json:"phone,omitempty"`
|
||||
}
|
||||
|
||||
type SelfOrderMenuResponse struct {
|
||||
OutletID uuid.UUID `json:"outlet_id"`
|
||||
OutletName string `json:"outlet_name"`
|
||||
TableID uuid.UUID `json:"table_id"`
|
||||
TableName string `json:"table_name"`
|
||||
Organization OrganizationMenuInfo `json:"organization"`
|
||||
Products ListProductsResponse `json:"products"`
|
||||
OutletName string `json:"outlet_name"`
|
||||
TableName string `json:"table_name"`
|
||||
Categories []SelfOrderMenuCategory `json:"categories"`
|
||||
}
|
||||
|
||||
type OrganizationMenuInfo struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
type SelfOrderMenuCategory struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Order int `json:"order"`
|
||||
Products []SelfOrderMenuItem `json:"products"`
|
||||
}
|
||||
|
||||
type SelfOrderMenuItem struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Price float64 `json:"price"`
|
||||
ImageURL *string `json:"image_url,omitempty"`
|
||||
Variants []SelfOrderMenuVariant `json:"variants,omitempty"`
|
||||
}
|
||||
|
||||
type SelfOrderMenuVariant struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
PriceModifier float64 `json:"price_modifier"`
|
||||
}
|
||||
|
||||
type SelfOrderCreateOrderRequest struct {
|
||||
TableID uuid.UUID `json:"table_id" validate:"required"`
|
||||
CustomerName string `json:"customer_name" validate:"required"`
|
||||
Phone *string `json:"phone,omitempty"`
|
||||
OrderItems []SelfOrderCreateOrderItem `json:"order_items" validate:"required,min=1,dive"`
|
||||
}
|
||||
|
||||
type SelfOrderCreateOrderItem struct {
|
||||
ProductID uuid.UUID `json:"product_id" validate:"required"`
|
||||
ProductVariantID *uuid.UUID `json:"product_variant_id,omitempty"`
|
||||
Quantity int `json:"quantity" validate:"required,min=1"`
|
||||
Notes *string `json:"notes,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user