Exemple #1
0
// DeleteLikingOnArticle deletes liking on article.
func DeleteLikingOnArticle(c *gin.Context) (int, error) {
	article := &model.Article{}
	status, err := likingService.DeleteLiking(c, article)
	if err != nil {
		return status, err
	}
	status, err = UpdateArticleLikingCount(article)
	if err != nil {
		return status, err
	}
	return http.StatusOK, nil
}
Exemple #2
0
// DeleteLikingOnLocation deletes liking on location.
func DeleteLikingOnLocation(c *gin.Context) (int, error) {
	location := &model.Location{}
	status, err := likingService.DeleteLiking(c, location)
	if err != nil {
		return status, err
	}
	status, err = UpdateLocationLikingCount(location)
	if err != nil {
		return status, err
	}
	return http.StatusOK, nil
}
Exemple #3
0
// DeleteLikingOnUser deletes liking on a user.
func DeleteLikingOnUser(c *gin.Context) (int, error) {
	user := &model.User{}
	status, err := likingService.DeleteLiking(c, user)
	if err != nil {
		return status, err
	}
	// if err == nil {
	log.Debug("DeleteLikingOnUser likingDeleted")
	status, err = UpdateUserLikingCount(user)
	if err != nil {
		return status, err
	}
	status, err = UpdateUserLikedCount(c)
	// if err != nil {
	return status, err
	// }

	// 	log.Debugf("DeleteLikingOnUser error %v", err)
	// 	if err == nil {
	// 		err = UpdateUserLikedCount(c)
	// 	}
	// // }
	// return err
}