예제 #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
}
예제 #2
0
파일: liking.go 프로젝트: tka/goyangi
// 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
}
예제 #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
}