Documentation ¶
Index ¶
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 (*Event) ValidateSchema ¶
ValidateSchema valida la estructura para ser insertada en la db
type EventService ¶
type EventService interface { SavePlaceOrder(data *PlacedOrderData) (*Event, error) SavePayment(data *PaymentEvent) (*Event, error) SaveArticleExist(data *ValidationEvent) (*Event, error) FindByOrderId(orderId string) ([]*Event, error) }
func NewEventService ¶
func NewEventService(log log.LogRusEntry, repository EventsRepository) EventService
type EventsRepository ¶
type EventsRepository interface { Insert(event *Event) (*Event, error) FindPlaceByCartId(cartId string) (*Event, error) FindByOrderId(orderId string) ([]*Event, error) }
func NewEventsRepository ¶
func NewEventsRepository(log log.LogRusEntry, collection db.Collection) EventsRepository
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.