Пример #1
0
// UpdateUserLikingCount updates user liking count.
func UpdateUserLikingCount(user *model.User) (int, error) {
	log.Debug("UpdateUserLikingCount performed")
	user.LikingCount = db.ORM.Model(user).Association("Likings").Count()
	if db.ORM.Save(user).Error != nil {
		return http.StatusInternalServerError, errors.New("User liking count is not updated.")
	}
	return http.StatusOK, nil
}