Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOrderNotFound = errors.New("order not found")
Functions ¶
This section is empty.
Types ¶
type OrderDTO ¶
type OrderDTO struct { ID primitive.ObjectID `bson:"_id,omitempty"` CustomerID primitive.ObjectID `bson:"customer_id"` OrderDetails []OrderDetailDTO `bson:"order_details"` OrderDate time.Time `bson:"order_date"` TotalAmount float64 `bson:"total_amount"` Status string `bson:"status"` }
func NewOrderDTO ¶
type OrderDetailDTO ¶
type OrderDetailDTO struct { ProductID primitive.ObjectID `bson:"product_id"` Quantity int `bson:"quantity"` Price float64 `bson:"price"` }
func NewOrderDetailDTO ¶
func NewOrderDetailDTO(productID primitive.ObjectID, quantity int, price float64) *OrderDetailDTO
type OrderRepository ¶
type OrderRepository struct { Ctx context.Context Collection *mongo.Collection }
func NewOrderRepository ¶
func NewOrderRepository(ctx context.Context, DB *mongo.Database) OrderRepository
func (OrderRepository) FindByCustomerID ¶
func (c OrderRepository) FindByCustomerID(customerID primitive.ObjectID) ([]OrderDTO, error)
func (OrderRepository) GetTotalAmountSpent ¶
func (cc OrderRepository) GetTotalAmountSpent(orderHistories []primitive.ObjectID) (float64, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.