Example #1
0
// CreateLikingOnArticle creates a liking on article.
func CreateLikingOnArticle(c *gin.Context) (int, error) {
	article := &model.Article{}
	status, err := likingService.CreateLiking(c, article)
	if err != nil {
		return status, err
	}
	status, err = UpdateArticleLikingCount(article)
	if err != nil {
		return status, err
	}
	return http.StatusOK, nil
}
Example #2
0
// CreateLikingOnLocation creates a liking on location.
func CreateLikingOnLocation(c *gin.Context) (int, error) {
	location := &model.Location{}
	status, err := likingService.CreateLiking(c, location)
	if err != nil {
		return status, err
	}
	status, err = UpdateLocationLikingCount(location)
	if err != nil {
		return status, err
	}
	return http.StatusOK, nil
}
Example #3
0
// CreateLikingOnUser creates liking on user.
func CreateLikingOnUser(c *gin.Context) (int, error) {
	user := &model.User{}
	status, err := likingService.CreateLiking(c, user)
	if err != nil {
		return status, err
	}
	status, err = UpdateUserLikingCount(user)
	if err != nil {
		return status, err
	}
	// if err == nil {
	status, err = UpdateUserLikedCount(c)
	return status, err
	// }
	// if err != nil {
	// 	return err, 400
	// }
}