db

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleAdmin         = "Admin"
	RoleStoreAdmin    = "Store Admin"
	RoleStoreStandard = "Store Standard"
)

Variables

This section is empty.

Functions

func CollectionAllergens

func CollectionAllergens(ctx context.Context) (*mongo.Collection, error)

func CollectionCarts

func CollectionCarts(ctx context.Context) (*mongo.Collection, error)

func CollectionProductCategories

func CollectionProductCategories(ctx context.Context) (*mongo.Collection, error)

func CollectionProductOptions

func CollectionProductOptions(ctx context.Context) (*mongo.Collection, error)

func CollectionProducts

func CollectionProducts(ctx context.Context) (*mongo.Collection, error)

func CollectionStores

func CollectionStores(ctx context.Context) (*mongo.Collection, error)

func CollectionTaxes

func CollectionTaxes(ctx context.Context) (*mongo.Collection, error)

func CollectionUsers

func CollectionUsers(ctx context.Context) (*mongo.Collection, error)

Types

type Allergen

type Allergen struct {
	ID        primitive.ObjectID `bson:"_id" json:"id"`
	ShortText string             `bson:"shortText" json:"shortText"`
	LongText  string             `bson:"longText" json:"longText"`
	CreatedAt time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type Cart

type Cart struct {
	ID            primitive.ObjectID `bson:"_id" json:"id"`
	IsPickup      bool               `bson:"isPickup" json:"isPickup"`
	Items         []CartItem         `bson:"items" json:"items"`
	Secret        string             `bson:"secret" json:"secret"`
	Payments      []Payment          `bson:"payments" json:"payments"`
	Paid          bool               `bson:"paid" json:"paid"`
	InvoiceNumber *string            `bson:"invoiceNumber" json:"invoiceNumber"`
	CreatedAt     time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt     time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type CartItem

type CartItem struct {
	ProductID string            `bson:"productId" json:"productId"`
	Options   map[string]string `bson:"optionValues" json:"optionValues"`
	Amount    int               `bson:"amount" json:"amount"`
}

type CustomizablePrice

type CustomizablePrice struct {
	Value        string            `bson:"value" json:"value"`
	CustomValues map[string]string `bson:"customValues" json:"customValues"`
}

type Image

type Image struct {
	URL     string `bson:"url" json:"url"`
	Title   string `bson:"title" json:"title"`
	AltText string `bson:"altText" json:"altText"`
}

type Payment added in v3.0.1

type Payment struct {
	Session     checkout.CreateCheckoutSessionResponse `bson:"session" json:"session"`
	Environment string                                 `bson:"environment" json:"environment"`
	Client      string                                 `bson:"client" json:"client"`
	Events      []notification.NotificationRequestItem `bson:"events" json:"events"`
}

type Product

type Product struct {
	ID               primitive.ObjectID `bson:"_id" json:"id"`
	SKU              string             `bson:"sku" json:"sku"`
	Name             string             `bson:"name" json:"name"`
	Price            CustomizablePrice  `bson:"price" json:"price"`
	TaxClassStandard string             `bson:"taxClassStandard" json:"taxClassStandard"`
	TaxClassTakeAway string             `bson:"taxClassTakeAway" json:"taxClassTakeAway"`
	Categories       []string           `bson:"categories" json:"categories"`
	Images           []Image            `bson:"images" json:"images"`
	Options          []string           `bson:"options" json:"options"`
	Variations       []ProductVariation `bson:"variations" json:"variations"`
	DisabledIn       []string           `bson:"disabledIn" json:"disabledIn"`
	OutOfStockIn     []string           `bson:"outOfStockIn" json:"outOfStockIn"`
	Description      string             `bson:"description" json:"description"`
	Allergens        []string           `bson:"allergens" json:"allergens"`
	CreatedAt        time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt        time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type ProductCategory

type ProductCategory struct {
	ID          primitive.ObjectID `bson:"_id" json:"id"`
	Name        string             `bson:"name" json:"name"`
	DisplayName string             `bson:"displayName" json:"displayName"`
	CreatedAt   time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt   time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type ProductOption

type ProductOption struct {
	ID          primitive.ObjectID   `bson:"_id" json:"id"`
	Name        string               `bson:"name" json:"name"`
	DisplayName string               `bson:"displayName" json:"displayName"`
	Values      []ProductOptionValue `bson:"values" json:"values"`
	CreatedAt   time.Time            `bson:"createdAt" json:"createdAt"`
	UpdatedAt   time.Time            `bson:"updatedAt" json:"updatedAt"`
}

type ProductOptionValue

type ProductOptionValue struct {
	Name         string   `bson:"name" json:"name"`
	DisplayName  string   `bson:"displayName" json:"displayName"`
	PrintName    string   `bson:"printName" json:"printName"`
	Image        *Image   `bson:"image" json:"image"`
	DisabledIn   []string `bson:"disabledIn" json:"disabledIn"`
	OutOfStockIn []string `bson:"outOfStockIn" json:"outOfStockIn"`
	Allergens    []string `bson:"allergens" json:"allergens"`
}

type ProductVariation

type ProductVariation struct {
	SKU     string                   `bson:"sku" json:"sku"`
	Price   CustomizablePrice        `bson:"price" json:"price"`
	Options []ProductVariationOption `bson:"options" json:"options"`
}

type ProductVariationOption

type ProductVariationOption struct {
	Name  string `bson:"name" json:"name"`
	Value string `bson:"value" json:"value"`
}

type RoleEntry

type RoleEntry struct {
	Name  string  `bson:"name" json:"name"`
	Store *string `bson:"store,omitempty" json:"store,omitempty"`
}

type Store

type Store struct {
	ID                   primitive.ObjectID `bson:"_id" json:"id"`
	Email                string             `bson:"email" json:"email"`
	Telephone            string             `bson:"telephone" json:"telephone"`
	Name                 string             `bson:"name" json:"name"`
	Key                  string             `bson:"key" json:"key"`
	Address              string             `bson:"address" json:"address"`
	Owner                string             `bson:"owner" json:"owner"`
	BusinessRegistration string             `bson:"businessRegistration" json:"businessRegistration"`
	TaxNumber            string             `bson:"taxNumber" json:"taxNumber"`
	MBW                  map[string]string  `bson:"mbw" json:"mbw"`
	Slots                []map[string]bool  `bson:"slots" json:"slots"` // week starts with Sunday = index 0
	CreatedAt            time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt            time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type Tax

type Tax struct {
	ID          primitive.ObjectID `bson:"_id" json:"id"`
	Name        string             `bson:"name" json:"name"`
	DisplayName string             `bson:"displayName" json:"displayName"`
	Rate        string             `bson:"rate" json:"rate"`
	CreatedAt   time.Time          `bson:"createdAt" json:"createdAt"`
	UpdatedAt   time.Time          `bson:"updatedAt" json:"updatedAt"`
}

type User

type User struct {
	ID    primitive.ObjectID `bson:"_id" json:"id"`
	User  string             `bson:"user" json:"user"`
	Email string             `bson:"email" json:"email"`
	Roles []RoleEntry        `bson:"roles" json:"roles"`
}

Jump to

Keyboard shortcuts

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