Documentation ¶
Index ¶
- func Category(categoryParams types.RouteParams) fiber.Router
- func CategoryRoutes(categoryParams types.RouteParams)
- func CreateCategory(db *gorm.DB, category models.Category) (*models.Category, error)
- func DeleteCategory(db *gorm.DB, id uuid.UUID) error
- func GetCategories(db *gorm.DB, pageInfo fiberpaginate.PageInfo) ([]models.Category, error)
- func GetCategory(db *gorm.DB, id uuid.UUID) (*models.Category, error)
- func UpdateCategory(db *gorm.DB, id uuid.UUID, category models.Category) (*models.Category, error)
- type CategoryController
- func (cat *CategoryController) CreateCategory(c *fiber.Ctx) error
- func (cat *CategoryController) DeleteCategory(c *fiber.Ctx) error
- func (cat *CategoryController) GetCategories(c *fiber.Ctx) error
- func (cat *CategoryController) GetCategory(c *fiber.Ctx) error
- func (cat *CategoryController) UpdateCategory(c *fiber.Ctx) error
- type CategoryService
- func (c *CategoryService) CreateCategory(categoryBody categories.CategoryRequestBody) (*models.Category, error)
- func (c *CategoryService) DeleteCategory(id string) error
- func (c *CategoryService) GetCategories(pageInfo fiberpaginate.PageInfo) ([]models.Category, error)
- func (c *CategoryService) GetCategory(id string) (*models.Category, error)
- func (c *CategoryService) UpdateCategory(id string, categoryBody categories.CategoryRequestBody) (*models.Category, error)
- type CategoryServiceInterface
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 GetCategories ¶
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 categories.CategoryRequestBody true "Category Body" @Success 201 {object} models.Category @Failure 400 {string} error @Failure 401 {string} error @Failure 404 {string} error @Failure 409 {string} error @Failure 500 {string} 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} error @Failure 401 {string} error @Failure 404 {string} error @Failure 500 {string} 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} error @Failure 404 {string} error @Failure 500 {string} 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} error @Failure 404 {string} error @Failure 500 {string} 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 categories.CategoryRequestBody true "Category Body" @Success 200 {object} models.Category @Failure 400 {string} error @Failure 401 {string} error @Failure 404 {string} error @Failure 500 {string} error @Router /categories/{categoryID}/ [patch]
type CategoryService ¶
type CategoryService struct {
types.ServiceParams
}
func (*CategoryService) CreateCategory ¶
func (c *CategoryService) CreateCategory(categoryBody categories.CategoryRequestBody) (*models.Category, error)
func (*CategoryService) DeleteCategory ¶
func (c *CategoryService) DeleteCategory(id string) error
func (*CategoryService) GetCategories ¶
func (c *CategoryService) GetCategories(pageInfo fiberpaginate.PageInfo) ([]models.Category, error)
func (*CategoryService) GetCategory ¶
func (c *CategoryService) GetCategory(id string) (*models.Category, error)
func (*CategoryService) UpdateCategory ¶
func (c *CategoryService) UpdateCategory(id string, categoryBody categories.CategoryRequestBody) (*models.Category, error)
type CategoryServiceInterface ¶
type CategoryServiceInterface interface { CreateCategory(categoryBody categories.CategoryRequestBody) (*models.Category, error) GetCategories(pageInfo fiberpaginate.PageInfo) ([]models.Category, error) GetCategory(id string) (*models.Category, error) UpdateCategory(id string, params categories.CategoryRequestBody) (*models.Category, error) DeleteCategory(id string) error }
func NewCategoryService ¶
func NewCategoryService(params types.ServiceParams) CategoryServiceInterface