Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOrderRequest ¶
type CreateOrderRequest struct {
ClientID int64 `json:"-"`
RestaurantID int `json:"rest_id"`
Products []ProductRequest `json:"products"`
TotalPrice float64 `json:"-"`
Subtotal float64 `json:"-"`
}
type OrderDataProvider ¶
type OrderDataProvider interface {
GetRestaurantByID(restID int, productsIDS []int) (Restaurant, error)
}
type OrderHandler ¶
type OrderHandler struct {
// contains filtered or unexported fields
}
func NewOrderHandler ¶
func NewOrderHandler(orderService *OrderService) *OrderHandler
func (*OrderHandler) CreateOrder ¶
func (h *OrderHandler) CreateOrder(orderDataProvider OrderDataProvider) gin.HandlerFunc
func (*OrderHandler) GetOrder ¶
func (h *OrderHandler) GetOrder(ctx *gin.Context)
func (*OrderHandler) UpdateOrderStatus ¶
func (h *OrderHandler) UpdateOrderStatus(ctx *gin.Context)
type OrderRepo ¶
type OrderRepo interface {
GetOrderById(id int64) (Order, error)
UpdateOrderStatus(id int64, status string) error
GetOrderDetailsByOrderId(id int64) ([]OrdersDetails, error)
Create(order CreateOrderRequest) (int64, error)
}
func NewOrderRepo ¶
type OrderRequest ¶
type OrderResponse ¶
type OrderResponse struct {
Order `json:"order"`
Items []orderItem `json:"items"`
}
type OrderService ¶
type OrderService struct {
// contains filtered or unexported fields
}
func NewOrderService ¶
func NewOrderService(orderRepo OrderRepo) *OrderService
func (*OrderService) CreateOrder ¶
func (os *OrderService) CreateOrder(order CreateOrderRequest, restaurant Restaurant) (int64, error)
func (*OrderService) GetOrderById ¶
func (s *OrderService) GetOrderById(id int64) (Order, []OrdersDetails, error)
func (*OrderService) UpdateOrderStatus ¶
func (s *OrderService) UpdateOrderStatus(id int64, status string) error
type OrdersDetails ¶
type ProductData ¶
type ProductRequest ¶
type Restaurant ¶
type RestaurantData ¶
Click to show internal directories.
Click to hide internal directories.