productModel

package
v0.0.0-...-dd40e37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	Name  string `bson:"name" json:"name"`
	Email string `bson:"email" json:"email"`
}

type Feature

type Feature struct {
	Type  string `bson:"type" json:"type"`
	Value string `bson:"value" json:"value"`
}

type Product

type Product struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Category    string             `bson:"category" json:"category" validate:"required"`
	Priority    int                `bson:"priority" json:"priority" default:"1"`
	Name        string             `bson:"name" json:"name" validate:"required" index:"unique"`
	Family      string             `bson:"family" json:"family" validate:"required"`
	Description string             `bson:"description" json:"description" validate:"required"`
	Image       string             `bson:"image" json:"image" validate:"required"`
	Images      []string           `bson:"images" json:"images"`
	Price       float64            `bson:"price" json:"price" validate:"required,min=0"`
	Stock       int                `bson:"stock" json:"stock" validate:"required,min=0"`
	CreatedAt   time.Time          `bson:"createdAt" json:"createdAt" immutable:"true"`
	UpdatedAt   time.Time          `bson:"updatedAt" json:"updatedAt"`
	VideoURL    string             `bson:"videoUrl,omitempty" json:"videoUrl,omitempty"`
	Features    []Feature          `bson:"features" json:"features"`
	Ratings     Rating             `bson:"ratings" json:"ratings"`
	Reviews     []Review           `bson:"reviews" json:"reviews"`
}

type Rating

type Rating struct {
	Average float64 `bson:"average" json:"average" default:"0"`
	Count   int     `bson:"count" json:"count" default:"0"`
}

type Review

type Review struct {
	Customer   Customer  `bson:"customer" json:"customer"`
	Rating     float64   `bson:"rating" json:"rating"`
	Review     string    `bson:"review" json:"review"`
	ReviewDate time.Time `bson:"reviewDate" json:"reviewDate"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL