Esempio n. 1
0
// CreateCommentOnLocation creates comment on location.
func CreateCommentOnLocation(c *gin.Context) (int, error) {
	location := &model.Location{}
	status, err := commentService.CreateComment(c, location)
	if err != nil {
		return status, err
	}
	status, err = UpdateLocationCommentCount(location)
	if err != nil {
		return status, err
	}
	return http.StatusCreated, nil
}
Esempio n. 2
0
// CreateCommentOnArticle creates a comment to an article.
func CreateCommentOnArticle(c *gin.Context) (int, error) {
	article := &model.Article{}
	status, err := commentService.CreateComment(c, article)
	if err != nil {
		return status, err
	}
	status, err = UpdateArticleCommentCount(article)
	if err != nil {
		return status, err
	}
	return http.StatusCreated, nil
}