Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrID = errs.NewValidation().Add("id", "Invalid")
Functions ¶
This section is empty.
Types ¶
type Cart ¶
type Cart struct { ID primitive.ObjectID `bson:"_id" json:"_id"` UserId string `bson:"userId" json:"userId" validate:"required,min=1,max=100"` OrderId string `bson:"orderId" json:"orderId"` Articles []*Article `bson:"articles" json:"articles" validate:"required"` Enabled bool `bson:"enabled" json:"enabled"` Created time.Time `bson:"created" json:"created"` Updated time.Time `bson:"updated" json:"updated"` }
Estuctura basica de del evento
type CartRepository ¶
type CartRepository interface { FindByUserId(userId string) (*Cart, error) FindById(cartId string) (*Cart, error) Insert(crt *Cart) (*Cart, error) Replace(crt *Cart) (*Cart, error) Invalidate(crt *Cart) (*Cart, error) NewCart(userId string) *Cart }
func NewCartRepository ¶
func NewCartRepository(log log.LogRusEntry, collection db.Collection) CartRepository
type CartService ¶
type CartService interface { CurrentCart(userId string) (*Cart, error) AddArticle(userId string, articleId string, quantity int) (*Cart, error) RemoveArticle(userId string, articleId string) (*Cart, error) ProcessOrderPlaced(data *OrderPlacedEvent) error InvalidateCurrentCart(cry *Cart) (*Cart, error) FindCartById(cartId string) (*Cart, error) ProcessArticleData(data *ValidationEvent) error }
func NewCartService ¶
func NewCartService(log log.LogRusEntry, repository CartRepository) CartService
type DbDeleteTokenBody ¶
type DbDeleteTokenBody struct {
Enabled bool `bson:"enabled"`
}
type DbDeleteTokenDocument ¶
type DbDeleteTokenDocument struct {
Set DbDeleteTokenBody `bson:"$set"`
}
type DbIdFilter ¶
type DbUserIdFilter ¶
type OrderPlacedEvent ¶
type ValidationEvent ¶
Click to show internal directories.
Click to hide internal directories.