handlers

package
v0.0.0-...-b59d68e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryHandlers

type CategoryHandlers struct {
	// contains filtered or unexported fields
}

func NewCategoryHandlers

func NewCategoryHandlers(categorys CategoryService, logger LoggerInterface) *CategoryHandlers

func (*CategoryHandlers) Create

func (h *CategoryHandlers) Create(w http.ResponseWriter, r *http.Request)

func (*CategoryHandlers) Delete

func (h *CategoryHandlers) Delete(w http.ResponseWriter, r *http.Request, categoryID string)

func (*CategoryHandlers) Get

func (h *CategoryHandlers) Get(w http.ResponseWriter, r *http.Request, categoryID string)

func (*CategoryHandlers) GetAll

func (h *CategoryHandlers) GetAll(w http.ResponseWriter, r *http.Request)

func (*CategoryHandlers) Update

func (h *CategoryHandlers) Update(w http.ResponseWriter, r *http.Request, categoryID string)

type CategoryService

type CategoryService interface {
	FindAll() ([]m.Category, error)
	FindSingle(categoryID uint) (m.Category, error)
	Create(category m.Category) (m.Category, error)
	Update(category m.Category, categoryID uint) (m.Category, error)
	Delete(categoryID uint) error
}

type HanderUtils

type HanderUtils struct {
	// contains filtered or unexported fields
}

func NewHanderUtils

func NewHanderUtils(logger LoggerInterface) *HanderUtils

type ImageService

type ImageService interface {
	UploadImage(file multipart.File, recipeID int) bool
}

type IngredientHandlers

type IngredientHandlers struct {
	// contains filtered or unexported fields
}

func NewIngredientHandlers

func NewIngredientHandlers(ingredients IngredientService, logger LoggerInterface) *IngredientHandlers

func (IngredientHandlers) Create

Create an ingredient

func (IngredientHandlers) Delete

func (h IngredientHandlers) Delete(w http.ResponseWriter, r *http.Request, ingredientID string)

Delete an ingredient

func (IngredientHandlers) GetAll

Get all ingredients

func (IngredientHandlers) GetSingle

func (h IngredientHandlers) GetSingle(w http.ResponseWriter, r *http.Request, ingredientID string)

Get a single ingredient

func (IngredientHandlers) GetUnits

Get all units

func (IngredientHandlers) Update

func (h IngredientHandlers) Update(w http.ResponseWriter, r *http.Request, ingredientID string)

type IngredientService

type IngredientService interface {
	FindAll() ([]m.Ingredient, error)
	FindUnits() ([]m.Unit, error)
	FindSingle(ingredientID uint) (m.Ingredient, error)
	Create(ingredient m.Ingredient) (m.Ingredient, error)
	Update(ingredient m.Ingredient, ingredientID uint) (m.Ingredient, error)
	Delete(ingredientID uint) error
}

type LoggerInterface

type LoggerInterface interface {
	Debugf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
}

type RecipeHandlers

type RecipeHandlers struct {
	// contains filtered or unexported fields
}

func NewRecipeHandlers

func NewRecipeHandlers(recipes RecipeService, imageService ImageService, logger LoggerInterface) *RecipeHandlers

func (RecipeHandlers) Create

func (h RecipeHandlers) Create(user *m.User, w http.ResponseWriter, r *http.Request)
func (h RecipeHandlers) CreateIngredientLink(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) CreateInstruction

func (h RecipeHandlers) CreateInstruction(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) Delete

func (h RecipeHandlers) Delete(w http.ResponseWriter, r *http.Request, recipeID string)
func (h RecipeHandlers) DeleteIngredientLink(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) DeleteInstruction

func (h RecipeHandlers) DeleteInstruction(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) Get

func (h RecipeHandlers) Get(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) GetAll

func (h RecipeHandlers) GetAll(w http.ResponseWriter, r *http.Request)
func (h RecipeHandlers) GetIngredientLink(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) GetInstruction

func (h RecipeHandlers) GetInstruction(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) ImageUpload

func (h RecipeHandlers) ImageUpload(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) Update

func (h RecipeHandlers) Update(w http.ResponseWriter, r *http.Request, recipeID string)
func (h RecipeHandlers) UpdateIngredientLink(w http.ResponseWriter, r *http.Request, recipeID string)

func (RecipeHandlers) UpdateInstruction

func (h RecipeHandlers) UpdateInstruction(w http.ResponseWriter, r *http.Request, recipeID string)

type RecipeService

type RecipeService interface {
	FindAll() ([]m.Recipe, error)
	FindSingle(recipeID uint) (m.Recipe, error)
	Create(recipe m.Recipe) (m.Recipe, error)
	Update(recipe m.Recipe, recipeID uint) (m.Recipe, error)
	Delete(recipeID uint) error

	FindInstruction(recipeID uint) (m.Instruction, error)
	CreateInstruction(instruction m.Instruction, recipeID uint) (m.Instruction, error)
	UpdateInstruction(instruction m.Instruction, recipeID uint) (m.Instruction, error)
	DeleteInstruction(recipeID uint) error

	FindIngredientLink(recipeID uint) ([]m.RecipeIngredient, error)
	CreateIngredientLink(link []m.RecipeIngredient, recipeID uint) ([]m.RecipeIngredient, error)
	UpdateIngredientLink(link []m.RecipeIngredient, recipeID uint) ([]m.RecipeIngredient, error)
	DeleteIngredientLink(link []m.RecipeIngredient, recipeID uint) error
}

type TagHandlers

type TagHandlers struct {
	// contains filtered or unexported fields
}

func NewTagHandlers

func NewTagHandlers(tags TagService, logger LoggerInterface) *TagHandlers

func (*TagHandlers) Create

func (h *TagHandlers) Create(w http.ResponseWriter, r *http.Request)

func (*TagHandlers) Delete

func (h *TagHandlers) Delete(w http.ResponseWriter, r *http.Request, tagID string)

func (*TagHandlers) Get

func (h *TagHandlers) Get(w http.ResponseWriter, r *http.Request, tagID string)

func (*TagHandlers) GetAll

func (h *TagHandlers) GetAll(w http.ResponseWriter, r *http.Request)

func (*TagHandlers) Update

func (h *TagHandlers) Update(w http.ResponseWriter, r *http.Request, tagID string)

type TagService

type TagService interface {
	FindAll() ([]m.Tag, error)
	FindSingle(tagID uint) (m.Tag, error)
	Create(tag m.Tag) (m.Tag, error)
	Update(tag m.Tag, tagID uint) (m.Tag, error)
	Delete(tagID uint) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL