models

package
v0.0.0-...-b8be85b Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: Apache-2.0 Imports: 1 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 {
	gorm.Model
	Name     string `json:"name"`
	Email    string `json:"email" gorm:"unique"`
	Password string `json:"password"`
}

Customer represents a simple user who browses and buys items.

type Inventory

type Inventory struct {
	gorm.Model
	ShopID        uint   `json:"shop_id"` // Foreign key to Shop.
	InventoryName string `json:"inventory_name"`
	Items         []Item `json:"items"` // One-to-many relationship.
}

Inventory represents a shop's collection of items.

type Item

type Item struct {
	gorm.Model
	InventoryID uint   `json:"inventory_id"` // Foreign key to Inventory.
	Name        string `json:"name"`
	Quantity    int    `json:"quantity"`
}

Item represents a product in an inventory.

type Shop

type Shop struct {
	gorm.Model
	Name        string         `json:"name"`
	Email       string         `json:"email" gorm:"unique"`
	OwnerID     uint           `json:"owner_id"`    // Reference to the shop owner.
	Owner       ShopOwner      `json:"owner"`       // One-to-one relation.
	Employees   []ShopEmployee `json:"employees"`   // One-to-many relation.
	Inventories []Inventory    `json:"inventories"` // One-to-many relation.
}

Shop represents the business entity with its inventories and staff.

type ShopEmployee

type ShopEmployee struct {
	gorm.Model
	Name     string `json:"name"`
	Email    string `json:"email" gorm:"unique"`
	Password string `json:"password"`
	ShopID   uint   `json:"shop_id"` // Foreign key to the Shop.
}

ShopEmployee represents a user working within the shop’s scope.

type ShopOwner

type ShopOwner struct {
	gorm.Model
	Name     string `json:"name"`
	Email    string `json:"email" gorm:"unique"`
	Password string `json:"password"`
}

ShopOwner represents a user who can manage the shop (and its employees/inventories).

Jump to

Keyboard shortcuts

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