Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct {
ID ModelID `gorm:"primary_key" json:"id"`
}
BaseModel is the base model for all models
func (*BaseModel) BeforeCreate ¶
func (m *BaseModel) BeforeCreate()
BeforeCreate hook that creates a uuid for the model
type Category ¶
type Category struct { BaseModel Name string `gorm:"unique;not null" json:"name"` Description string `json:"description"` }
Category is used to differentiate recipes
type Comment ¶
type Comment struct { BaseModel Content string UserID ModelID User User RecipeID ModelID Recipe Recipe CreatedAt time.Time }
Comment defines a recipe comment
type Recipe ¶
type Recipe struct { BaseModel Title string `gorm:"unique;not null" json:"title"` Description string `json:"description"` UsedProducts string `validate:"required" json:"usedProducts"` Picture string `json:"picture"` CookingTime int `validate:"required" json:"cookingTime"` UserID ModelID `json:"userid"` User User `json:"user"` CategoryID ModelID `json:"categoryid"` Category Category `json:"category"` Comments []Comment `json:"comments"` CreatedAt time.Time `json:"createdAt"` }
Recipe defines a cooking recipe
type User ¶
type User struct { BaseModel Username string `gorm:"unique;not null" json:"username"` Email string `gorm:"unique;not null" json:"email"` Password string `gorm:"not null" json:"password"` Picture string `json:"picture"` RoleID ModelID `json:"roleid"` Role Role `json:"role"` Recipes []Recipe `json:"recipes"` Comments []Comment `json:"comments"` }
User is application user
type UserResult ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.