article

package
v0.0.0-...-c86e3d9 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRoutes

func ApplyRoutes(r *gin.RouterGroup, jwtAuth jwt.Auth)

ApplyRoutes All routes for articles

func CreateArticle

func CreateArticle(c *gin.Context)

CreateArticle will generate a command CreateArticleCommand @Summary Create article in elastic search @Tags articles @Accept json @Produce json @Param article body Request true "Add article" @Success 201 {object} pkg.HTTPStatus "created" @Failure 500 {object} pkg.HTTPError "Internal Server Error" @Router /articles [post]

func GetArticle

func GetArticle(c *gin.Context)

GetArticle returns article from read-model index from elastic search @Summary Get an article from elastic search @Description Get article struct @Tags articles @Accept json @Produce json @Param aggregate_article_id path int true "Article ID" @Success 200 {object} database.Article @Failure 404 {object} pkg.HTTPError "Article Not found" @Router /articles/{aggregate_article_id} [get]

func GetArticles

func GetArticles(c *gin.Context)

GetArticles returns array of article from elastic search @Summary Get all articles from elastic search @Description Get an array of article struct @Tags articles @Accept json @Produce json @Success 200 {string} string "GET /articles" @Router /articles [get]

func UpdateArticle

func UpdateArticle(c *gin.Context)

UpdateArticle will generate a command UpdateArticleCommand @Summary Update article in elastic search @Tags articles @Accept json @Produce json @Param aggregate_article_id path int true "Article ID" @Param article body Request true "Update article" @Success 201 {object} pkg.HTTPStatus "updated" @Failure 500 {object} pkg.HTTPError "Internal Server Error" @Router /articles/{aggregate_article_id}} [put]

Types

type Request

type Request struct {
	Title       string
	Description string
}

Jump to

Keyboard shortcuts

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