models

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Menu struct {
	ID           string
	SubMenu      string
	PriceAgentID int64
	Extra        string
}

func NewMenu

func NewMenu(menuData string) (*Menu, error)

NewMenu returns a menu struct from a given menuData string. The menu follows the format <menuID>_<submenuID>_<priceagentID>[_<extraData>]

type NotificationSettings

type NotificationSettings struct {
	CreatedAt       time.Time
	UpdatedAt       time.Time
	ID              int64   `gorm:"primarykey"`
	NotifyAlways    bool    `json:"notifyAlways" gorm:"default:true"`
	NotifyPriceDrop bool    `json:"notifyPriceDrop" gorm:"default:false"`
	NotifyPriceRise bool    `json:"notifyPriceRise" gorm:"default:false"`
	NotifyAbove     bool    `json:"notifyAbove" gorm:"default:false"`
	NotifyBelow     bool    `json:"notifyBelow" gorm:"default:false"`
	AbovePrice      float64 `json:"abovePrice" gorm:"default:0"`
	BelowPrice      float64 `json:"belowPrice" gorm:"default:0"`
}

func (NotificationSettings) String

func (ns NotificationSettings) String() string

type PriceAgent

type PriceAgent struct {
	CreatedAt            time.Time
	ID                   int64                `json:"id" gorm:"primarykey;autoIncrement:true"`
	Name                 string               `json:"name"`
	UserID               int64                `json:"user_id" gorm:"not null;default:null;index:user_entity_idx,unique"`
	User                 User                 `json:"user" gorm:"foreignkey:UserID"`
	EntityID             int64                `json:"-" gorm:"index:user_entity_idx,unique"`
	Entity               geizhals.Entity      `json:"entity" gorm:"foreignkey:EntityID"`
	Location             string               `json:"location" gorm:"default:de"`
	NotificationID       int64                `json:"-"`
	NotificationSettings NotificationSettings `json:"notificationSettings" gorm:"foreignkey:NotificationID;constraint:OnDelete:CASCADE;"`
	Enabled              bool                 `json:"enabled" gorm:"default:1"`
}

func (PriceAgent) CurrentEntityPrice

func (pa PriceAgent) CurrentEntityPrice() geizhals.EntityPrice

func (PriceAgent) CurrentPrice

func (pa PriceAgent) CurrentPrice() float64

func (PriceAgent) EntityURL

func (pa PriceAgent) EntityURL() string

func (PriceAgent) GetCurrency

func (pa PriceAgent) GetCurrency() geizhals.Currency

func (PriceAgent) String

func (pa PriceAgent) String() string

type User

type User struct {
	ID          int64        `json:"id" gorm:"unique;primaryKey"`
	CreatedAt   time.Time    `json:"-"`
	UpdatedAt   time.Time    `json:"-"`
	Username    string       `json:"username"`
	FirstName   string       `json:"first_name"`
	LastName    string       `json:"last_name"`
	LangCode    string       `json:"language_code"`
	DarkMode    bool         `json:"dark_mode" gorm:"default:1"`
	PriceAgents []PriceAgent `json:"-"`
}

Jump to

Keyboard shortcuts

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