Documentation ¶
Index ¶
- type Article
- type Event
- func FindByOrderId(orderId string, deps ...interface{}) ([]*Event, error)
- func SaveArticleExist(data *ValidationEvent, deps ...interface{}) (*Event, error)
- func SavePayment(data *PaymentEvent, deps ...interface{}) (*Event, error)
- func SavePlaceOrder(data *PlacedOrderData, deps ...interface{}) (*Event, error)
- type EventType
- type PaymentEvent
- type PaymentMethod
- type PlaceEvent
- type PlacePrderArticleData
- type PlacedOrderData
- type ValidationEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { ID primitive.ObjectID `bson:"_id,omitempty"` OrderId string `bson:"orderId" validate:"required,min=1,max=100"` Type EventType `bson:"type" validate:"required"` PlaceEvent *PlaceEvent `bson:"placeEvent"` Validation *ValidationEvent `bson:"validation"` Payment *PaymentEvent `bson:"payment"` Created time.Time `bson:"created"` Updated time.Time `bson:"updated"` }
Estuctura basica de del evento
func FindByOrderId ¶
FindAll devuelve todos los eventos por order id
func SaveArticleExist ¶
func SaveArticleExist(data *ValidationEvent, deps ...interface{}) (*Event, error)
SaveArticleExist saves the event for article exist
func SavePayment ¶
func SavePayment(data *PaymentEvent, deps ...interface{}) (*Event, error)
SavePayment saves a payment event
func SavePlaceOrder ¶
func SavePlaceOrder(data *PlacedOrderData, deps ...interface{}) (*Event, error)
SavePlaceOrder saves the event for place order
func (*Event) ValidateSchema ¶
ValidateSchema valida la estructura para ser insertada en la db
type PaymentEvent ¶
type PaymentEvent struct { OrderId string `bson:"orderId" binding:"required"` Method PaymentMethod `bson:"metod" binding:"required"` Amount float32 `bson:"amount" binding:"required"` }
type PaymentMethod ¶
type PaymentMethod string
const ( Cash PaymentMethod = "CASH" Credit PaymentMethod = "CREDIT" Debit PaymentMethod = "DEBIT" )
type PlaceEvent ¶
type PlacePrderArticleData ¶
type PlacedOrderData ¶
type PlacedOrderData struct { CartId string `json:"cartId" binding:"required,min=1,max=100"` UserId string `json:"userId" binding:"required,min=1,max=100"` Articles []PlacePrderArticleData `json:"articles" binding:"required,gt=0"` }
Click to show internal directories.
Click to hide internal directories.