models

package
v1.0.2-a Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveDuplicates

func RemoveDuplicates[T string | int | *Product](input []T) []T

Types

type BillingAddress

type BillingAddress struct {
	ID          uint      `gorm:"primarykey"`
	CreatedAt   time.Time `gorm:"index"`
	UpdatedAt   time.Time `gorm:"index"`
	City        string
	Street      string
	ZIP         string
	Number      string
	Notes       []*Note
	CustomerID  uint
	CreatedByID uint
	CreatedBy   *User
}

func (*BillingAddress) Save

func (billingAddress *BillingAddress) Save(db *gorm.DB) error

type Customer

type Customer struct {
	ID                uint      `gorm:"primarykey"`
	CreatedAt         time.Time `gorm:"index"`
	UpdatedAt         time.Time `gorm:"index"`
	Name              string
	Gender            string
	Orders            []*Order
	BillingAddresses  []*BillingAddress
	DeliveryAddresses []*DeliveryAddress
	Tels              []*Tel
	CreatedByID       uint
	CreatedBy         *User
	Notes             []*Note
	LoginId           uint
	Login             *Login
}

func (*Customer) CreateLogin

func (customer *Customer) CreateLogin(email string, emailClient *service.EmailClient, db *gorm.DB) error

func (*Customer) Save

func (customer *Customer) Save(db *gorm.DB) error

type DeliveryAddress

type DeliveryAddress struct {
	ID          uint      `gorm:"primarykey"`
	CreatedAt   time.Time `gorm:"index"`
	UpdatedAt   time.Time `gorm:"index"`
	City        string
	Street      string
	ZIP         string
	Number      string
	CustomerID  uint
	TelID       uint
	Tel         []*Tel
	Notes       []*Note
	CreatedByID uint
	CreatedBy   *User
}

func (*DeliveryAddress) Save

func (deliveryAddress *DeliveryAddress) Save(db *gorm.DB) error

type Invoice

type Invoice struct {
	ID         uint      `gorm:"primarykey"`
	CreatedAt  time.Time `gorm:"index"`
	UpdatedAt  time.Time `gorm:"index"`
	Positions  []*Position
	CustomerID uint
	Customer   *Customer
	OrderID    uint
	Order      *Order
	Notes      []*Note
}

func (*Invoice) Save

func (invoice *Invoice) Save(db *gorm.DB) error

type Login

type Login struct {
	ID          uint      `gorm:"primarykey"`
	CreatedAt   time.Time `gorm:"index"`
	UpdatedAt   time.Time `gorm:"index"`
	Password    string
	Email       string
	LastLogin   time.Time
	LoginResets []*LoginReset
	Notes       []*Note
}

func (*Login) ResetPassword

func (login *Login) ResetPassword(newPassword string, db *gorm.DB) error

func (*Login) Save

func (login *Login) Save(db *gorm.DB) error

func (*Login) SendDefaultPasswordEmail

func (login *Login) SendDefaultPasswordEmail(password string, emailClient *service.EmailClient) error

func (*Login) SendLoginResetEmail

func (login *Login) SendLoginResetEmail(reset *LoginReset, emailClient *service.EmailClient) error

type LoginReset

type LoginReset struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`
	Token     string
	Active    bool
	Notes     []*Note
	LoginID   uint
}

func (*LoginReset) Save

func (loginReset *LoginReset) Save(db *gorm.DB) error

type Note

type Note struct {
	ID                uint      `gorm:"primarykey"`
	CreatedAt         time.Time `gorm:"index"`
	UpdatedAt         time.Time `gorm:"index"`
	Title             string
	Content           string
	UserID            uint
	CustomerID        uint
	BillingAddressID  uint
	DeliveryAddressID uint
	InvoiceID         uint
	LoginID           uint
	LoginResetID      uint
	CreatedByID       uint
	OrderID           uint
	PositionID        uint
	ProductID         uint
	RoleID            uint
	TelID             uint
	CreatedBy         *User
}

func (*Note) Save

func (note *Note) Save(db *gorm.DB) error

type Order

type Order struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`

	Due               time.Time
	PrintedAt         time.Time
	PayedAt           time.Time
	DoneAt            time.Time
	CustomerID        uint
	Customer          *Customer
	BillingAddressID  uint
	BillingAddress    *BillingAddress
	DeliveryAddressID uint
	DeliveryAddress   *DeliveryAddress
	Notes             []*Note
	Invoices          []*Invoice
	CreatedByID       uint
	CreatedBy         *User
	// contains filtered or unexported fields
}

func (*Order) Save

func (order *Order) Save(db *gorm.DB) error

type Position

type Position struct {
	ID          uint      `gorm:"primarykey"`
	CreatedAt   time.Time `gorm:"index"`
	UpdatedAt   time.Time `gorm:"index"`
	Name        string
	Description string
	UnitPrice   float64
	Amount      int
	InvoiceID   uint
	Notes       []*Note
}

func (*Position) Save

func (position *Position) Save(db *gorm.DB) error

type Product

type Product struct {
	ID          uint      `gorm:"primarykey"`
	CreatedAt   time.Time `gorm:"index"`
	UpdatedAt   time.Time `gorm:"index"`
	Name        string
	Description string
	Price       float64
	Notes       []*Note
}

func (*Product) Save

func (product *Product) Save(db *gorm.DB) error

type Role

type Role struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`
	Name      string
	Notes     []*Note
}

func (*Role) Save

func (role *Role) Save(db *gorm.DB) error

type Tel

type Tel struct {
	ID                uint      `gorm:"primarykey"`
	CreatedAt         time.Time `gorm:"index"`
	UpdatedAt         time.Time `gorm:"index"`
	Tel               string
	CustomerID        uint
	DeliveryAddressID uint

	Notes []*Note
}

func (*Tel) Save

func (tel *Tel) Save(db *gorm.DB) error

type User

type User struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`
	Name      string
	Username  string
	Password  string
	LastLogin time.Time
	Sessions  []*UserSession
	Notes     []*Note
}

func (*User) CreateUserSession

func (user *User) CreateUserSession(db *gorm.DB) (*UserSession, error)

func (*User) ResetPassword

func (user *User) ResetPassword(newPassword string) error

func (*User) Save

func (user *User) Save(db *gorm.DB) error

type UserSession

type UserSession struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`
	Token     string
	Active    bool
	UserId    uint
	User      *User
	UserID    uint
}

func (*UserSession) Logout

func (session *UserSession) Logout(db *gorm.DB) error

func (*UserSession) Save

func (session *UserSession) Save(db *gorm.DB) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳