base

package
v0.0.0-...-b704f0f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Category

func Category(categoryParams types.RouteParams) fiber.Router

func CategoryRoutes

func CategoryRoutes(categoryParams types.RouteParams)

func CreateCategory

func CreateCategory(db *gorm.DB, category models.Category) (*models.Category, *errors.Error)

func DeleteCategory

func DeleteCategory(db *gorm.DB, id uuid.UUID) *errors.Error

func GetCategories

func GetCategories(db *gorm.DB, limit int, page int) ([]models.Category, *errors.Error)

func GetCategory

func GetCategory(db *gorm.DB, id uuid.UUID) (*models.Category, *errors.Error)

func UpdateCategory

func UpdateCategory(db *gorm.DB, id uuid.UUID, category models.Category) (*models.Category, *errors.Error)

Types

type CategoryController

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

func NewCategoryController

func NewCategoryController(categoryService CategoryServiceInterface) *CategoryController

func (*CategoryController) CreateCategory

func (cat *CategoryController) CreateCategory(c *fiber.Ctx) error

CreateCategory godoc

@Summary Creates a category @Description Creates a category @ID create-category @Tags category @Accept json @Produce json @Param categoryBody body models.CategoryRequestBody true "Category Body" @Success 201 {object} models.Category @Failure 400 {string} errors.Error @Failure 401 {string} errors.Error @Failure 404 {string} errors.Error @Failure 409 {string} errors.Error @Failure 500 {string} errors.Error @Router /categories/ [post]

func (*CategoryController) DeleteCategory

func (cat *CategoryController) DeleteCategory(c *fiber.Ctx) error

DeleteCategory godoc

@Summary Deletes a category @Description Deletes a category @ID delete-category @Tags category @Produce json @Param categoryID path string true "Category ID" @Success 204 {string} utilities.SuccessResponse @Failure 400 {string} errors.Error @Failure 401 {string} errors.Error @Failure 404 {string} errors.Error @Failure 500 {string} errors.Error @Router /categories/{categoryID}/ [delete]

func (*CategoryController) GetCategories

func (cat *CategoryController) GetCategories(c *fiber.Ctx) error

GetCategories godoc

@Summary Retrieve all categories @Description Retrieves all categories @ID get-categories @Tags category @Produce json @Param limit query int false "Limit" @Param page query int false "Page" @Success 200 {object} []models.Category @Failure 400 {string} errors.Error @Failure 404 {string} errors.Error @Failure 500 {string} errors.Error @Router /categories/ [get]

func (*CategoryController) GetCategory

func (cat *CategoryController) GetCategory(c *fiber.Ctx) error

GetCategory godoc

@Summary Retrieve a category @Description Retrieves a category @ID get-category @Tags category @Produce json @Param categoryID path string true "Category ID" @Success 200 {object} models.Category @Failure 400 {string} errors.Error @Failure 404 {string} errors.Error @Failure 500 {string} errors.Error @Router /categories/{categoryID}/ [get]

func (*CategoryController) UpdateCategory

func (cat *CategoryController) UpdateCategory(c *fiber.Ctx) error

UpdateCategory godoc

@Summary Updates a category @Description Updates a category @ID update-category @Tags category @Accept json @Produce json @Param categoryID path string true "Category ID" @Param categoryBody body models.CategoryRequestBody true "Category Body" @Success 200 {object} models.Category @Failure 400 {string} errors.Error @Failure 401 {string} errors.Error @Failure 404 {string} errors.Error @Failure 500 {string} errors.Error @Router /categories/{categoryID}/ [patch]

type CategoryService

type CategoryService struct {
	types.ServiceParams
}

func (*CategoryService) CreateCategory

func (c *CategoryService) CreateCategory(categoryBody models.CategoryRequestBody) (*models.Category, *errors.Error)

func (*CategoryService) DeleteCategory

func (c *CategoryService) DeleteCategory(id string) *errors.Error

func (*CategoryService) GetCategories

func (c *CategoryService) GetCategories(limit string, page string) ([]models.Category, *errors.Error)

func (*CategoryService) GetCategory

func (c *CategoryService) GetCategory(id string) (*models.Category, *errors.Error)

func (*CategoryService) UpdateCategory

func (c *CategoryService) UpdateCategory(id string, categoryBody models.CategoryRequestBody) (*models.Category, *errors.Error)

type CategoryServiceInterface

type CategoryServiceInterface interface {
	CreateCategory(categoryBody models.CategoryRequestBody) (*models.Category, *errors.Error)
	GetCategories(limit string, page string) ([]models.Category, *errors.Error)
	GetCategory(id string) (*models.Category, *errors.Error)
	UpdateCategory(id string, params models.CategoryRequestBody) (*models.Category, *errors.Error)
	DeleteCategory(id string) *errors.Error
}

func NewCategoryService

func NewCategoryService(params types.ServiceParams) CategoryServiceInterface

Jump to

Keyboard shortcuts

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