Documentation ¶
Index ¶
- type RecipesHandler
- func (handler *RecipesHandler) DeleteRecipe(c *gin.Context)
- func (handler *RecipesHandler) ListRecipe(c *gin.Context)
- func (handler *RecipesHandler) ListRecipes(c *gin.Context)
- func (handler *RecipesHandler) NewRecipe(c *gin.Context)
- func (handler *RecipesHandler) SearchRecipe(c *gin.Context)
- func (handler *RecipesHandler) UpdateRecipe(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RecipesHandler ¶
type RecipesHandler struct { Collection *mongo.Collection Ctx context.Context // contains filtered or unexported fields }
func NewRecipesHandler ¶
func NewRecipesHandler(ctx context.Context, collection *mongo.Collection, redisClient *redis.Client) *RecipesHandler
ListRecipes godoc
@Summary List recipes @Description get all recipes @Tags recipes @Accept json @Produce json @Success 200 {array} models.Recipe @Failure 500 {object} models.Error @Router /recipes [get]
func (*RecipesHandler) DeleteRecipe ¶
func (handler *RecipesHandler) DeleteRecipe(c *gin.Context)
DeleteRecipe godoc @Summary Delete recipe @Tags recipes @Accept json @Produce json @Param id path string true "Recipe ID" @Success 200 {object} models.Message @Failure 400 {object} models.Error @Failure 500 {object} models.Error @Router /recipes/{id} [delete]
func (*RecipesHandler) ListRecipe ¶
func (handler *RecipesHandler) ListRecipe(c *gin.Context)
ListRecipe godoc @Summary List recipe @Tags recipes @Accept json @Produce json @Param id path string true "Recipe ID" @Success 200 {object} models.Recipe @Failure 400 {object} models.Error @Failure 404 {object} models.Error @Failure 500 {object} models.Error @Router /recipes/{id} [get]
func (*RecipesHandler) ListRecipes ¶
func (handler *RecipesHandler) ListRecipes(c *gin.Context)
Defining receiver functions for `RecipesHandler`
func (*RecipesHandler) NewRecipe ¶
func (handler *RecipesHandler) NewRecipe(c *gin.Context)
NewRecipe godoc
@Summary Create recipe @Description create new recipe @Tags recipes @Accept json @Produce json @Param recipe body models.UserDefinedRecipe true "New recipe" @Success 200 {object} models.Recipe @Failure 400 {object} models.Error @Failure 500 {object} models.Error @Router /recipes [post]
func (*RecipesHandler) SearchRecipe ¶
func (handler *RecipesHandler) SearchRecipe(c *gin.Context)
SearchRecipe godoc @Summary Search recipes by tag @Tags recipes @Accept json @Produce json @Param tag query string true "Recipe search by tag" @Success 200 {array} models.Recipe @Failure 400 {object} models.Error @Failure 500 {object} models.Error @Router /recipes/search [get]
func (*RecipesHandler) UpdateRecipe ¶
func (handler *RecipesHandler) UpdateRecipe(c *gin.Context)
UpdateRecipe godoc @Summary Update recipe @Tags recipes @Accept json @Produce json @Param id path string true "Recipe ID" @Param recipe body models.Recipe true "Updated receipe" @Success 200 {object} models.Message @Failure 400 {object} models.Error @Failure 500 {object} models.Error @Router /recipes/{id} [put]