handler

package
v0.0.0-...-8f202a6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArticleHandler

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

func NewArticleHandler

func NewArticleHandler(au domain.ArticleUsecase) *ArticleHandler

func (*ArticleHandler) Create

func (h *ArticleHandler) Create(c *fiber.Ctx) error

Create godoc @Summary Create a new article @Description Create a new article with the provided data @Tags articles @Accept json @Produce json @Param article body domain.CreateArticleRequest true "Article data" @Success 201 {object} domain.ArticleResponse @Failure 400 {object} response.ErrorResponse @Security BearerAuth @Router /articles [post]

func (*ArticleHandler) Delete

func (h *ArticleHandler) Delete(c *fiber.Ctx) error

Delete godoc @Summary Delete an article @Description Delete an article by its ID @Tags articles @Accept json @Produce json @Param id path string true "Article ID" @Success 204 "No Content" @Failure 400 {object} response.ErrorResponse @Failure 404 {object} response.ErrorResponse @Security BearerAuth @Router /articles/{id} [delete]

func (*ArticleHandler) GetByID

func (h *ArticleHandler) GetByID(c *fiber.Ctx) error

GetByID godoc @Summary Get article by ID @Description Get article details by its ID @Tags articles @Accept json @Produce json @Param id path string true "Article ID" @Success 200 {object} domain.ArticleResponse @Failure 400 {object} response.ErrorResponse @Failure 404 {object} response.ErrorResponse @Router /articles/{id} [get]

func (*ArticleHandler) GetBySlug

func (h *ArticleHandler) GetBySlug(c *fiber.Ctx) error

GetBySlug godoc @Summary Get article by slug @Description Get article details by its slug @Tags articles @Accept json @Produce json @Param slug path string true "Article Slug" @Success 200 {object} domain.ArticleResponse @Failure 404 {object} response.ErrorResponse @Router /articles/slug/{slug} [get]

func (*ArticleHandler) IncrementVisitorCount

func (h *ArticleHandler) IncrementVisitorCount(c *fiber.Ctx) error

IncrementVisitorCount godoc @Summary Increment article visitor count @Description Increment the visitor count of an article @Tags articles @Accept json @Produce json @Param id path string true "Article ID" @Success 200 {object} response.Response @Failure 400 {object} response.ErrorResponse @Failure 404 {object} response.ErrorResponse @Router /articles/{id}/increment-visitor [post]

func (*ArticleHandler) List

func (h *ArticleHandler) List(c *fiber.Ctx) error

List godoc @Summary List articles @Description Get a list of articles with pagination @Tags articles @Accept json @Produce json @Param page query int false "Page number" @Param limit query int false "Number of items per page" @Param status query string false "Article status (published, draft, scheduled)" @Success 200 {object} domain.ArticlesResponse @Failure 400 {object} response.ErrorResponse @Router /articles [get]

func (*ArticleHandler) Update

func (h *ArticleHandler) Update(c *fiber.Ctx) error

Update godoc @Summary Update an article @Description Update an existing article with the provided data @Tags articles @Accept json @Produce json @Param id path string true "Article ID" @Param article body domain.UpdateArticleRequest true "Article data" @Success 200 {object} domain.ArticleResponse @Failure 400 {object} response.ErrorResponse @Failure 404 {object} response.ErrorResponse @Security BearerAuth @Router /articles/{id} [put]

Jump to

Keyboard shortcuts

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