store

package
v0.0.0-...-add2f5a Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProduct

func AddProduct(prod []Product, id string)

func AddUser

func AddUser(user User) string

func Customer

func Customer(id string)

func DeleteProduct

func DeleteProduct(cartproducts []CartAdd, id string) []string

func DeleteWishlist

func DeleteWishlist(wishProd []Wishlist, id string) []string

func GenerateUniqueID

func GenerateUniqueID() string

func LoginVendor

func LoginVendor(vendorlog VendorLogin) (int, string)

func RegisterAdmin

func RegisterAdmin(vendor Vendor) (int, string)

func SetupDBConeection

func SetupDBConeection(cfg conf.Config)

func UpadateCart

func UpadateCart(cartproducts []CartAdd, id string) []string

func VendorGet

func VendorGet(token string)

func Wishlist_add

func Wishlist_add(wish []Wishlist, id string) []string

Types

type Address

type Address struct {
	House   string `json:"house_name" bson:"house_name"`
	Street  string `json:"street_name" bson:"street_name"`
	City    string `json:"city_name" bson:"city_name"`
	Pincode string `json:"pin_code" bson:"pin_code"`
}

func Login

func Login(l UserLogin) (int, string, []Address)

type CartAdd

type CartAdd struct {
	ProductName string `json:"product_name"`
	Price       int    `json:"price,omitempty"`
	Quantity    int    `json:"quantity"`
}

func ViewCart

func ViewCart(id string) []CartAdd

func ViewWishlist

func ViewWishlist(id string) []CartAdd

type Collection

type Collection struct {
	NewUser        *mongo.Collection
	Cutomer        *mongo.Collection
	Product        *mongo.Collection
	VendorRegister *mongo.Collection
	Vendor         *mongo.Collection
}

func GetdbConnection

func GetdbConnection() Collection

type CustomerDatabase

type CustomerDatabase struct {
	UserID          string    `json:"user_id" bson:"user_id"`
	Cart            []CartAdd `bson:"cart"`
	EmailID         string    `bson:"email_id"`
	Address         []Address `bson:"Adress"`
	ProductWishList []CartAdd `bson:"wishlist"`
	Password        string    `bson:"password"`
}

type Product

type Product struct {
	VendorID    string `json:"vendor_id,omitempty" bson:"vendor_id"`
	Category    string `jsno:"category" bson:"category"`
	ProductID   string `jsno:"product_id,omitempty" bson:"product_id"`
	ProductName string `json:"product_name" bson:"product_name"`
	Price       int    `json:"price" bson:"price"`
	Quantity    int    `json:"quantity" bson:"quantity"`
}

type User

type User struct {
	ID         primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	First_Name string             `json:"first_name" bson:"first_name" validate:"required"`
	Last_Name  string             `json:"last_name" bson:"last_name" validate:"required"`
	Password   string             `json:"password" bson:"password" validate:"required,min=4"`
	EmailID    string             `json:"email_id" bson:"email_id" validate:"required"`
	Phone_No   string             `json:"phone_no" bson:"phone_no" validate:"required"`
	UserID     string             `json:"user_id,omitempty" bson:"user_id"`
	Address    []Address          `json:"address,omitempty" bson:"address" validate:"required"`
}

type UserLogin

type UserLogin struct {
	UserID   string    `json:"user_id,omitempty"`
	EmailID  string    `json:"email_id" validate:"required"`
	Password string    `json:"password" validate:"required,min=4"`
	Add      []Address `json:"address,omitempty"`
}

func (*UserLogin) EmailValid

func (l *UserLogin) EmailValid() bool

type Vendor

type Vendor struct {
	ID         primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	First_Name string             `json:"first_name" bson:"first_name"`
	Last_Name  string             `json:"last_name" bson:"last_name"`
	EmailID    string             `json:"email_id" bson:"email_id"`
	Company    string             `json:"company" bson:"company"`
	Password   string             `json:"password" bson:"password" validate:"required,min=4"`
	Phone_No   string             `json:"phone_no" bson:"phone_no"`
	Key        string             `json:"key" bson:"key" validate:"required"`
	Admin_id   string             `json:"admin_id,omitempty" bson:"admin_id"`
}

type VendorDashboard

type VendorDashboard struct {
	Vendor_id string    `bson:"admin_id"`
	EmailID   string    `bson:"email_id"`
	Password  string    `bson:"password"`
	Key       string    `bson:"key"`
	Product   []Product `bson:"product"`
}

type VendorLogin

type VendorLogin struct {
	Admin_id string `json:"admin_id,omitempty"`
	EmailID  string `json:"email_id" validate:"required"`
	Key      string `json:"key" validate:"required"`
	Password string `json:"password" validate:"required,min=4"`
}

func (*VendorLogin) EmailValidVendor

func (v *VendorLogin) EmailValidVendor() bool

type ViewProduct

type ViewProduct struct {
	ProductName string `json:"product_name"`
	Price       int    `json:"price"`
	Quantity    int    `json:"quantity"`
}

func AllProducts

func AllProducts() []ViewProduct

func SearchCategory

func SearchCategory(catName string) []ViewProduct

func SearchSpecificProduct

func SearchSpecificProduct(productname string) []ViewProduct

type Wishlist

type Wishlist struct {
	Product_name string `json:"product_name"`
}

Jump to

Keyboard shortcuts

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