services

package
v0.0.0-...-7b20b01 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryRepository

type CategoryRepository interface {
	FindAll() ([]m.Category, error)
	FindSingle(recipeID uint) (m.Category, error)
	Create(recipe m.Category) (m.Category, error)
	Update(recipe m.Category) (m.Category, error)
	Delete(recipe m.Category) error
}

type CategoryService

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

func NewCategoryService

func NewCategoryService(categoryRepo CategoryRepository) *CategoryService

NewCategoryService creates a new CategoryService instance

func (CategoryService) Create

func (s CategoryService) Create(category m.Category) (m.Category, error)

func (CategoryService) Delete

func (s CategoryService) Delete(categoryID uint) error

func (CategoryService) FindAll

func (s CategoryService) FindAll() ([]m.Category, error)

func (CategoryService) FindSingle

func (s CategoryService) FindSingle(categoryID uint) (m.Category, error)

func (CategoryService) Update

func (s CategoryService) Update(category m.Category, categoryID uint) (m.Category, error)

type ImageService

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

func NewImageService

func NewImageService(repo S3Repository, logger LoggerInterface) *ImageService

func (ImageService) UploadImage

func (s ImageService) UploadImage(file multipart.File, recipeID int) bool

type IngredientRepository

type IngredientRepository 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) (m.Ingredient, error)
	Delete(ingredient m.Ingredient) error
}

type IngredientService

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

func NewIngredientService

func NewIngredientService(ingredientRepo IngredientRepository) *IngredientService

NewRecipeService creates a new RecipeService instance

func (IngredientService) Create

func (s IngredientService) Create(ingredient m.Ingredient) (m.Ingredient, error)

func (IngredientService) Delete

func (s IngredientService) Delete(ingredientID uint) error

func (IngredientService) FindAll

func (s IngredientService) FindAll() ([]m.Ingredient, error)

func (IngredientService) FindSingle

func (s IngredientService) FindSingle(ingredientID uint) (m.Ingredient, error)

func (IngredientService) FindUnits

func (s IngredientService) FindUnits() ([]m.Unit, error)

func (IngredientService) Update

func (s IngredientService) Update(ingredient m.Ingredient, ingredientID uint) (m.Ingredient, error)

type LoggerInterface

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

type RecipeRepository

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

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

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

type RecipeService

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

func NewRecipeService

func NewRecipeService(recipeRepo RecipeRepository) *RecipeService

NewRecipeService creates a new RecipeService instance

func (RecipeService) Create

func (s RecipeService) Create(recipe m.Recipe) (m.Recipe, error)

Create handles the business logic for the creation of a recipe and passes the recipe object to the recipe repo for processing

func (s RecipeService) CreateIngredientLink(link []m.RecipeIngredient, recipeID uint) ([]m.RecipeIngredient, error)

func (RecipeService) CreateInstruction

func (s RecipeService) CreateInstruction(instruction m.Instruction, recipeID uint) (m.Instruction, error)

func (RecipeService) Delete

func (s RecipeService) Delete(recipeID uint) error
func (s RecipeService) DeleteIngredientLink(link []m.RecipeIngredient, recipeID uint) error

func (RecipeService) DeleteInstruction

func (s RecipeService) DeleteInstruction(recipeID uint) error

func (RecipeService) FindAll

func (s RecipeService) FindAll() ([]m.Recipe, error)

Find contains the business logic to get all recipes

func (s RecipeService) FindIngredientLink(recipeID uint) ([]m.RecipeIngredient, error)

func (RecipeService) FindInstruction

func (s RecipeService) FindInstruction(recipeID uint) (m.Instruction, error)

func (RecipeService) FindSingle

func (s RecipeService) FindSingle(recipeID uint) (m.Recipe, error)

Find contains the business logic to get a specific recipe

func (RecipeService) Update

func (s RecipeService) Update(recipe m.Recipe, recipeID uint) (m.Recipe, error)
func (s RecipeService) UpdateIngredientLink(link []m.RecipeIngredient, recipeID uint) ([]m.RecipeIngredient, error)

func (RecipeService) UpdateInstruction

func (s RecipeService) UpdateInstruction(instruction m.Instruction, recipeID uint) (m.Instruction, error)

type S3Repository

type S3Repository interface {
	UploadImage(file multipart.File, filename string, recipeID int) bool
}

type TagRepository

type TagRepository interface {
	FindAll() ([]m.Tag, error)
	FindSingle(recipeID uint) (m.Tag, error)
	Create(recipe m.Tag) (m.Tag, error)
	Update(recipe m.Tag) (m.Tag, error)
	Delete(recipe m.Tag) error
}

type TagService

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

func NewTagService

func NewTagService(tagRepo TagRepository) *TagService

NewTagService creates a new TagService instance

func (TagService) Create

func (s TagService) Create(tag m.Tag) (m.Tag, error)

func (TagService) Delete

func (s TagService) Delete(tagID uint) error

func (TagService) FindAll

func (s TagService) FindAll() ([]m.Tag, error)

func (TagService) FindSingle

func (s TagService) FindSingle(tagID uint) (m.Tag, error)

func (TagService) Update

func (s TagService) Update(tag m.Tag, tagID uint) (m.Tag, error)

Jump to

Keyboard shortcuts

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