22 lines
871 B
Go
22 lines
871 B
Go
package models
|
|
|
|
func (Supplement) TableName() string {
|
|
return "supplements"
|
|
}
|
|
|
|
type Supplement struct {
|
|
BaseModel
|
|
Name string `json:"name" db:"name"`
|
|
Description string `json:"description" db:"description"`
|
|
Price int `json:"price" db:"price"`
|
|
Image string `json:"image" db:"image"`
|
|
Nutrients []Nutrient `json:"nutrients" db:"nutrients" gorm:"many2many:supplement_nutrients;"`
|
|
SupplementNutrients []SupplementNutrient `json:"supplementNutrients" db:"supplementNutrients" gorm:"foreignKey:SupplementID"`
|
|
}
|
|
|
|
type DailySupplementsOverview struct {
|
|
Supplements []*Supplement `json:"supplements"`
|
|
Nutrients []*Nutrient `json:"nutrients"`
|
|
Overview []*SupplementNutrientOverview `json:"overview"`
|
|
}
|