Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID uuid.UUID `json:"id"` UserID uuid.UUID `json:"user_id" gorm:"size:191"` RecipeID uuid.UUID `json:"recipe_id" gorm:"size:191"` Content string `json:"content"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` User User `json:"commenter"` }
func (*Comment) MapResponse ¶
func (c *Comment) MapResponse() CommentResponse
type CommentResponse ¶
type Recipe ¶
type Recipe struct { ID uuid.UUID `json:"id"` UserID uuid.UUID `json:"user_id" gorm:"size:191"` Title string `json:"title"` Portion int `json:"portion"` CookingTime int `json:"cooking_time"` Description string `json:"description"` Ingredients string `json:"ingredients"` Instructions string `json:"instructions"` Tags string `json:"tags"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` User User `json:"author"` }
func (*Recipe) MapResponse ¶
func (r *Recipe) MapResponse() RecipeResponse
type RecipeResponse ¶
type RecipeResponse struct { ID uuid.UUID `json:"id"` Title string `json:"title"` Portion int `json:"portion"` CookingTime int `json:"cooking_time"` Description string `json:"description,omitempty"` Ingredients string `json:"ingredients,omitempty"` Instructions string `json:"instructions"` Tags string `json:"tags"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` User Author `json:"author"` Comments []CommentResponse `json:"comments"` }
type Response ¶
type Response struct { Code int `json:"code"` Message string `json:"message"` Errors []string `json:"errors"` Data interface{} `json:"data"` }
func StatusBadGateway ¶
func StatusBadRequest ¶
func StatusCreated ¶
func StatusCreated(data interface{}) Response
func StatusUnauthorized ¶
type User ¶
type User struct { ID uuid.UUID `json:"id"` Username string `json:"username"` Email string `json:"email"` Password string `json:"password,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*User) BeforeCreate ¶
GORM HOOKS CREATE USER ID AND HASH PASSWORD
func (*User) ComparePassword ¶
func (*User) GenerateToken ¶
func (*User) HashPassword ¶
type UserWithToken ¶
Click to show internal directories.
Click to hide internal directories.