-
Notifications
You must be signed in to change notification settings - Fork 53
/
order.go
28 lines (24 loc) · 882 Bytes
/
order.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package order
import "context"
// Order represents an order
type Order struct {
ID string `json:"id,omitempty"`
CustomerID string `json:"customer_id"`
Status string `json:"status"`
CreatedOn int64 `json:"created_on,omitempty"`
RestaurantId string `json:"restaurant_id"`
OrderItems []OrderItem `json:"order_items,omitempty"`
}
// OrderItem represents items in an order
type OrderItem struct {
ProductCode string `json:"product_code"`
Name string `json:"name"`
UnitPrice float32 `json:"unit_price"`
Quantity int32 `json:"quantity"`
}
// Repository describes the persistence on order model
type Repository interface {
CreateOrder(ctx context.Context, order Order) error
GetOrderByID(ctx context.Context, id string) (Order, error)
ChangeOrderStatus(ctx context.Context, id string, status string) error
}