model

package
v0.0.0-...-52e64fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID           primitive.ObjectID
	Name         string
	Email        string
	Address      string
	OrderHistory []primitive.ObjectID
}

type Order

type Order struct {
	ID           primitive.ObjectID
	CustomerID   primitive.ObjectID
	OrderDetails []OrderDetail
	OrderDate    time.Time
	Status       string
}

func NewOrder

func NewOrder(customerID primitive.ObjectID, orderDetails []OrderDetail, orderDate time.Time, status string) (*Order, error)

type OrderAdapter

type OrderAdapter interface {
	Create(dto *order_infrastructure.OrderDTO) (*order_infrastructure.OrderDTO, error)
	FindByCustomerID(customerID primitive.ObjectID) ([]order_infrastructure.OrderDTO, error)
	GetTotalAmountSpent(orderHistories []primitive.ObjectID) (float64, error)
}

type OrderDetail

type OrderDetail struct {
	ProductID primitive.ObjectID
	Quantity  int
	Price     float64
}

func NewOrderDetail

func NewOrderDetail(productID primitive.ObjectID, quantity int, price float64) *OrderDetail

type Product

type Product struct {
	ID                 primitive.ObjectID
	Name               string
	Description        string
	Price              float64
	Stock              int
	Category           string
	PromotionExpiresAt *time.Time
}

func NewProduct

func NewProduct(
	id primitive.ObjectID,
	name string,
	description string,
	price float64,
	stock int,
	category string,
	promotionExpiresAt *time.Time,
) (*Product, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL