Documentation ¶
Index ¶
- type Cart
- type CartItemPreviewDetails
- type CartItemPreviewProperties
- type CartRequestPayload
- type IRepository
- type IRequests
- type IUtils
- type InternalCart
- type InternalItem
- type ItemStatus
- type Repository
- func (r Repository) Delete(UserId string, itemId string) error
- func (r Repository) DeleteAll(UserId string) error
- func (r Repository) Get(UserId string) (internalCart []InternalCart, err error)
- func (r Repository) Register(UserId string, CartRequestPayload CartRequestPayload) error
- func (r Repository) Update(UserId string, CartRequestPayload CartRequestPayload) error
- type Requests
- type Utils
- func (r Utils) Convert(internalCarts map[string]InternalCart) (result []Cart)
- func (r Utils) GetTotalAmount(internalCarts map[string]InternalCart) int
- func (r Utils) Inspect(internalCarts []InternalCart) (result map[string]InternalCart, err error)
- func (r Utils) InspectPayload(CartRequestPayload CartRequestPayload, itemStatus items.ItemStatus) (result CartRequestPayload, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cart ¶
type Cart struct { ItemId string `json:"item_id"` Quantity int `json:"quantity"` ItemProperties CartItemPreviewProperties `json:"properties"` }
type CartItemPreviewDetails ¶
type CartItemPreviewDetails struct {
Status ItemStatus `json:"status"`
}
type CartItemPreviewProperties ¶
type CartItemPreviewProperties struct { Name string `json:"name"` Price int `json:"price"` Details CartItemPreviewDetails `json:"details"` }
type CartRequestPayload ¶
type IRepository ¶
type IRepository interface { Get(UserId string) ([]InternalCart, error) Register(UserId string, c CartRequestPayload) error Update(UserId string, c CartRequestPayload) error Delete(UserId string, itemId string) error DeleteAll(UserId string) error }
type IUtils ¶
type IUtils interface { Inspect([]InternalCart) (map[string]InternalCart, error) Convert(map[string]InternalCart) []Cart GetTotalAmount(map[string]InternalCart) int InspectPayload(c CartRequestPayload, itemStatus items.ItemStatus) (CartRequestPayload, error) }
type InternalCart ¶
type InternalItem ¶
type InternalItem struct { Price int `gorm:"price"` Name string `gorm:"name"` Description string `gorm:"description"` Tags []string `gorm:"tags"` Size int `gorm:"size"` ManufacturerUserId string `gorm:"manufacturer_user_id"` ManufacturerName string `gorm:"manufacturer_name"` ManufacturerDescription string `gorm:"manufacturer_description"` ManufacturerStripeId string `gorm:"manufacturer_stripe_account_id"` }
type ItemStatus ¶
type ItemStatus string
const ( Available ItemStatus = "Available" StockOver ItemStatus = "Stock over" NoStock ItemStatus = "No stock" InvalidItem ItemStatus = "Invalid item" )
type Repository ¶
func (Repository) DeleteAll ¶
func (r Repository) DeleteAll(UserId string) error
func (Repository) Get ¶
func (r Repository) Get(UserId string) (internalCart []InternalCart, err error)
func (Repository) Register ¶
func (r Repository) Register(UserId string, CartRequestPayload CartRequestPayload) error
func (Repository) Update ¶
func (r Repository) Update(UserId string, CartRequestPayload CartRequestPayload) error
type Requests ¶
type Requests struct { CartRepository IRepository CartUtils IUtils ItemGetStatus items.IGetStatus }
type Utils ¶
type Utils struct { }
func (Utils) Convert ¶
func (r Utils) Convert(internalCarts map[string]InternalCart) (result []Cart)
func (Utils) GetTotalAmount ¶
func (r Utils) GetTotalAmount(internalCarts map[string]InternalCart) int
func (Utils) Inspect ¶
func (r Utils) Inspect(internalCarts []InternalCart) (result map[string]InternalCart, err error)
func (Utils) InspectPayload ¶
func (r Utils) InspectPayload(CartRequestPayload CartRequestPayload, itemStatus items.ItemStatus) (result CartRequestPayload, err error)
Click to show internal directories.
Click to hide internal directories.