Documentation ¶
Index ¶
Constants ¶
View Source
const BalanceHistory = "balance"
View Source
const PurchaseHistory = "purchase"
View Source
const TransferHistory = "transfer"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultParams ¶
type DefaultParams struct { // in: query // required: false SortBy string `json:"sort_by"` // in: query // required: false Order string `json:"order"` // in: query // required: false Offset int `json:"offset"` // in: query // required: false Limit int `json:"limit"` }
swagger:parameters getProducts getUsers
type History ¶
type History struct { ModelTimes // The total amount of the purchase or balance update Total float64 `json:"total"` // The type of the history item Type string `json:"type"` // A list of all items from the purchase Items []PurchaseItem `json:"items,omitempty"` // The recipient of the tranfer Recipient string `json:"recipient,omitempty"` UserID uint `json:"-"` }
swagger:model
type HistoryArray ¶
type HistoryArray struct { // An array of purchases Histories []History `json:"purchases"` }
swagger:model
type Model ¶
type Model struct { ID uint `json:"id" gorm:"primary_key"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` }
gorm.Model definition
type ModelTimes ¶
type ModelTimes struct { ID uint `json:"id" gorm:"primary_key"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `json:"-"` }
gorm.Model
type NullString ¶
type NullString struct {
sql.NullString
}
func (NullString) MarshalJSON ¶
func (ns NullString) MarshalJSON() ([]byte, error)
func (*NullString) UnmarshalJSON ¶
func (ns *NullString) UnmarshalJSON(b []byte) error
type Permission ¶
type Permission struct { // The id for the product // // required: true // unique: true // min: 1 // // example: 1 Model // The name of the permission // // required: true // // example: AdminPermission Name string `gorm:"not_null"` // The description of the permission // // example: Can do everything Description string }
A generic Permission
swagger:model
type Product ¶
type Product struct { // The id for the product // // required: true // unique: true // min: 1 // // example: 1 Model ProductInformation }
A generic product
A generic product with some values ¶
swagger:model
type ProductInformation ¶
type ProductInformation struct { // The name of the product // // required: true // min: 1 // // example: club mate Name string `json:"name" gorm:"not_null;unique"` // The price of the product // // required: true // // example: 1.00 Price float64 `json:"price" gorm:"not_null"` // The description of the product // // required: false Description string `json:"description" gorm:"type:text;"` // An optional deposit meant for drinks // // required: false Deposit float64 `json:"deposit"` // The barcode of the product // // required: false Barcode NullString `json:"barcode" gorm:"unique;default: null"` // Currently the path to the image (tbi) // // required: false Image string `json:"image"` TimesBoughtTotal int `json:"times_bought_total" gorm:"-"` TimesBought int `json:"times_bought" gorm:"-"` LastBought *time.Time `json:"last_bought" gorm:"-"` // A flag to show if the product is currently buyable // // required: false Disabled bool `json:"disabled" gorm:"default:false"` }
type PurchaseItem ¶
type PurchaseItem struct { ModelTimes // The amount of products bought Amount int `json:"amount"` // Information about the bought product PurchaseItemInformation ProductID uint `json:"product_id"` HistoryID uint `json:"-"` }
swagger:model
type PurchaseItemInformation ¶
type PurchaseItemInformation struct { // The name of the product // // required: true // min: 1 // // example: club mate Name string `json:"name" gorm:"not_null"` // The price of the product // // required: true // // example: 1.00 Price float64 `json:"price" gorm:"not_null"` // The description of the product // // required: false Description string `json:"description" gorm:"type:text;"` // An optional deposit meant for drinks // // required: false Deposit float64 `json:"deposit"` // The barcode of the product // // required: false Barcode string `json:"barcode" gorm:"default: null"` // Currently the path to the image (tbi) // // required: false Image string `json:"image"` }
type Token ¶
type Token struct { Code string `json:"code"` Expire string `json:"expire"` Token string `json:"token"` }
The returned token
swagger:model Token
type User ¶
type User struct { Model // The username UserName string `json:"name" gorm:"not_null;unique;"` Password string `json:"-" gorm:"not_null"` // The displayname DisplayName string `json:"display_name" gorm:"not_null;"` // The users current balance Balance float64 `json:"balance"` // The Role the user has (as an integer) Role int `json:"role"` // A list of user permission Permissions []Permission `json:"permissions,omitempty" gorm:"many2many:user_permissions;"` // A list of purchases made by the user Histories []History `json:"histories,omitempty"` }
A generic User
swagger:model
Click to show internal directories.
Click to hide internal directories.