Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles reviews endpoints.
func NewHandler ¶
NewHandler returns a new review handler.
func (*Handler) Create ¶
func (h *Handler) Create() http.HandlerFunc
Create creates a new review and saves it.
func (*Handler) GetByID ¶
func (h *Handler) GetByID() http.HandlerFunc
GetByID lists the review with the id requested.
type Review ¶
type Review struct { ID zero.String `json:"id,omitempty"` Stars zero.Int `json:"stars,omitempty" validate:"min=0,max=5"` Comment zero.String `json:"comment,omitempty"` UserID zero.String `json:"user_id,omitempty" db:"user_id" validate:"required"` ProductID zero.String `json:"product_id,omitempty" db:"product_id" validate:"required_without=ShopID"` ShopID zero.String `json:"shop_id,omitempty" db:"shop_id" validate:"required_without=ProductID"` CreatedAt zero.Time `json:"created_at,omitempty" db:"created_at"` }
Review represents users critics over a shop or product.
Click to show internal directories.
Click to hide internal directories.